Revision f230a1cf deps/v8/src/type-info.cc
deps/v8/src/type-info.cc | ||
---|---|---|
128 | 128 |
} |
129 | 129 |
|
130 | 130 |
|
131 |
bool TypeFeedbackOracle::LoadIsPreMonomorphic(Property* expr) { |
|
132 |
Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); |
|
133 |
if (map_or_code->IsCode()) { |
|
134 |
Handle<Code> code = Handle<Code>::cast(map_or_code); |
|
135 |
return code->is_inline_cache_stub() && code->ic_state() == PREMONOMORPHIC; |
|
136 |
} |
|
137 |
return false; |
|
138 |
} |
|
139 |
|
|
140 |
|
|
131 | 141 |
bool TypeFeedbackOracle::LoadIsPolymorphic(Property* expr) { |
132 | 142 |
Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); |
133 | 143 |
if (map_or_code->IsCode()) { |
... | ... | |
166 | 176 |
} |
167 | 177 |
|
168 | 178 |
|
179 |
bool TypeFeedbackOracle::StoreIsPreMonomorphic(TypeFeedbackId ast_id) { |
|
180 |
Handle<Object> map_or_code = GetInfo(ast_id); |
|
181 |
if (map_or_code->IsCode()) { |
|
182 |
Handle<Code> code = Handle<Code>::cast(map_or_code); |
|
183 |
return code->ic_state() == PREMONOMORPHIC; |
|
184 |
} |
|
185 |
return false; |
|
186 |
} |
|
187 |
|
|
188 |
|
|
169 | 189 |
bool TypeFeedbackOracle::StoreIsKeyedPolymorphic(TypeFeedbackId ast_id) { |
170 | 190 |
Handle<Object> map_or_code = GetInfo(ast_id); |
171 | 191 |
if (map_or_code->IsCode()) { |
... | ... | |
251 | 271 |
Handle<String> name, |
252 | 272 |
SmallMapList* types) { |
253 | 273 |
Code::Flags flags = Code::ComputeFlags( |
254 |
Code::STUB, MONOMORPHIC, Code::kNoExtraICState,
|
|
274 |
Code::HANDLER, MONOMORPHIC, Code::kNoExtraICState,
|
|
255 | 275 |
Code::NORMAL, Code::LOAD_IC); |
256 | 276 |
CollectReceiverTypes(expr->PropertyFeedbackId(), name, flags, types); |
257 | 277 |
} |
... | ... | |
261 | 281 |
Handle<String> name, |
262 | 282 |
SmallMapList* types) { |
263 | 283 |
Code::Flags flags = Code::ComputeFlags( |
264 |
Code::STUB, MONOMORPHIC, Code::kNoExtraICState,
|
|
284 |
Code::HANDLER, MONOMORPHIC, Code::kNoExtraICState,
|
|
265 | 285 |
Code::NORMAL, Code::STORE_IC); |
266 | 286 |
CollectReceiverTypes(expr->AssignmentFeedbackId(), name, flags, types); |
267 | 287 |
} |
... | ... | |
381 | 401 |
Handle<Type>* left, |
382 | 402 |
Handle<Type>* right, |
383 | 403 |
Handle<Type>* result, |
384 |
Maybe<int>* fixed_right_arg) { |
|
404 |
Maybe<int>* fixed_right_arg, |
|
405 |
Token::Value operation) { |
|
385 | 406 |
Handle<Object> object = GetInfo(id); |
386 | 407 |
if (!object->IsCode()) { |
387 |
// For some binary ops we don't have ICs, e.g. Token::COMMA. |
|
408 |
// For some binary ops we don't have ICs, e.g. Token::COMMA, but for the |
|
409 |
// operations covered by the BinaryOpStub we should always have them. |
|
410 |
ASSERT(!(operation >= BinaryOpStub::FIRST_TOKEN && |
|
411 |
operation <= BinaryOpStub::LAST_TOKEN)); |
|
388 | 412 |
*left = *right = *result = handle(Type::None(), isolate_); |
389 | 413 |
return; |
390 | 414 |
} |
391 | 415 |
Handle<Code> code = Handle<Code>::cast(object); |
392 | 416 |
ASSERT(code->is_binary_op_stub()); |
393 | 417 |
|
394 |
int minor_key = code->stub_info(); |
|
395 |
BinaryOpIC::StubInfoToType(minor_key, left, right, result, isolate()); |
|
396 |
*fixed_right_arg = |
|
397 |
BinaryOpStub::decode_fixed_right_arg_from_minor_key(minor_key); |
|
418 |
BinaryOpStub stub(code->extended_extra_ic_state()); |
|
419 |
|
|
420 |
// Sanity check. |
|
421 |
ASSERT(stub.operation() == operation); |
|
422 |
|
|
423 |
*left = stub.GetLeftType(isolate()); |
|
424 |
*right = stub.GetRightType(isolate()); |
|
425 |
*result = stub.GetResultType(isolate()); |
|
426 |
*fixed_right_arg = stub.fixed_right_arg(); |
|
398 | 427 |
} |
399 | 428 |
|
400 | 429 |
|
... | ... | |
410 | 439 |
} |
411 | 440 |
|
412 | 441 |
|
413 |
TypeInfo TypeFeedbackOracle::IncrementType(CountOperation* expr) {
|
|
442 |
Handle<Type> TypeFeedbackOracle::IncrementType(CountOperation* expr) {
|
|
414 | 443 |
Handle<Object> object = GetInfo(expr->CountBinOpFeedbackId()); |
415 |
TypeInfo unknown = TypeInfo::Unknown();
|
|
444 |
Handle<Type> unknown(Type::None(), isolate_);
|
|
416 | 445 |
if (!object->IsCode()) return unknown; |
417 | 446 |
Handle<Code> code = Handle<Code>::cast(object); |
418 | 447 |
if (!code->is_binary_op_stub()) return unknown; |
419 | 448 |
|
420 |
BinaryOpIC::TypeInfo left_type, right_type, unused_result_type; |
|
421 |
BinaryOpStub::decode_types_from_minor_key(code->stub_info(), &left_type, |
|
422 |
&right_type, &unused_result_type); |
|
423 |
// CountOperations should always have +1 or -1 as their right input. |
|
424 |
ASSERT(right_type == BinaryOpIC::SMI || |
|
425 |
right_type == BinaryOpIC::UNINITIALIZED); |
|
426 |
|
|
427 |
switch (left_type) { |
|
428 |
case BinaryOpIC::UNINITIALIZED: |
|
429 |
case BinaryOpIC::SMI: |
|
430 |
return TypeInfo::Smi(); |
|
431 |
case BinaryOpIC::INT32: |
|
432 |
return TypeInfo::Integer32(); |
|
433 |
case BinaryOpIC::NUMBER: |
|
434 |
return TypeInfo::Double(); |
|
435 |
case BinaryOpIC::STRING: |
|
436 |
case BinaryOpIC::GENERIC: |
|
437 |
return unknown; |
|
438 |
default: |
|
439 |
return unknown; |
|
440 |
} |
|
441 |
UNREACHABLE(); |
|
442 |
return unknown; |
|
449 |
BinaryOpStub stub(code->extended_extra_ic_state()); |
|
450 |
return stub.GetLeftType(isolate()); |
|
443 | 451 |
} |
444 | 452 |
|
445 | 453 |
|
... | ... | |
634 | 642 |
|
635 | 643 |
case Code::KEYED_LOAD_IC: |
636 | 644 |
case Code::KEYED_STORE_IC: |
637 |
if (target->ic_state() == MONOMORPHIC || |
|
638 |
target->ic_state() == POLYMORPHIC) { |
|
639 |
SetInfo(ast_id, target); |
|
640 |
} |
|
641 |
break; |
|
642 |
|
|
643 | 645 |
case Code::BINARY_OP_IC: |
644 | 646 |
case Code::COMPARE_IC: |
645 | 647 |
case Code::TO_BOOLEAN_IC: |
Also available in: Unified diff