OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 64 matching lines...) Loading... |
75 ? Handle<Object>(dictionary_->ValueAt(entry)) | 75 ? Handle<Object>(dictionary_->ValueAt(entry)) |
76 : Isolate::Current()->factory()->undefined_value(); | 76 : Isolate::Current()->factory()->undefined_value(); |
77 } | 77 } |
78 | 78 |
79 | 79 |
80 bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) { | 80 bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) { |
81 Handle<Object> map_or_code(GetInfo(expr->id())); | 81 Handle<Object> map_or_code(GetInfo(expr->id())); |
82 if (map_or_code->IsMap()) return true; | 82 if (map_or_code->IsMap()) return true; |
83 if (map_or_code->IsCode()) { | 83 if (map_or_code->IsCode()) { |
84 Handle<Code> code(Code::cast(*map_or_code)); | 84 Handle<Code> code(Code::cast(*map_or_code)); |
85 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC && | 85 return code->is_keyed_load_stub() && |
| 86 code->ic_state() == MONOMORPHIC && |
86 code->FindFirstMap() != NULL; | 87 code->FindFirstMap() != NULL; |
87 } | 88 } |
88 return false; | 89 return false; |
89 } | 90 } |
90 | 91 |
91 | 92 |
92 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) { | 93 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) { |
93 Handle<Object> map_or_code(GetInfo(expr->id())); | 94 Handle<Object> map_or_code(GetInfo(expr->id())); |
94 if (map_or_code->IsMap()) return true; | 95 if (map_or_code->IsMap()) return true; |
95 if (map_or_code->IsCode()) { | 96 if (map_or_code->IsCode()) { |
96 Handle<Code> code(Code::cast(*map_or_code)); | 97 Handle<Code> code(Code::cast(*map_or_code)); |
97 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_STORE_IC && | 98 return code->is_keyed_store_stub() && |
98 code->FindFirstMap() != NULL; | 99 code->ic_state() == MONOMORPHIC; |
99 } | 100 } |
100 return false; | 101 return false; |
101 } | 102 } |
102 | 103 |
103 | 104 |
104 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { | 105 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
105 Handle<Object> value = GetInfo(expr->id()); | 106 Handle<Object> value = GetInfo(expr->id()); |
106 return value->IsMap() || value->IsSmi(); | 107 return value->IsMap() || value->IsSmi(); |
107 } | 108 } |
108 | 109 |
109 | 110 |
110 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { | 111 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { |
111 ASSERT(LoadIsMonomorphic(expr)); | 112 ASSERT(LoadIsMonomorphic(expr)); |
112 Handle<Object> map_or_code( | 113 Handle<Object> map_or_code( |
113 Handle<HeapObject>::cast(GetInfo(expr->id()))); | 114 Handle<HeapObject>::cast(GetInfo(expr->id()))); |
114 if (map_or_code->IsCode()) { | 115 if (map_or_code->IsCode()) { |
115 Handle<Code> code(Code::cast(*map_or_code)); | 116 Handle<Code> code(Code::cast(*map_or_code)); |
116 return Handle<Map>(code->FindFirstMap()); | 117 Map* first_map = code->FindFirstMap(); |
| 118 ASSERT(first_map != NULL); |
| 119 return Handle<Map>(first_map); |
117 } | 120 } |
118 return Handle<Map>(Map::cast(*map_or_code)); | 121 return Handle<Map>(Map::cast(*map_or_code)); |
119 } | 122 } |
120 | 123 |
121 | 124 |
122 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Expression* expr) { | 125 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Expression* expr) { |
123 ASSERT(StoreIsMonomorphic(expr)); | 126 ASSERT(StoreIsMonomorphic(expr)); |
124 Handle<HeapObject> map_or_code( | 127 Handle<HeapObject> map_or_code( |
125 Handle<HeapObject>::cast(GetInfo(expr->id()))); | 128 Handle<HeapObject>::cast(GetInfo(expr->id()))); |
126 if (map_or_code->IsCode()) { | 129 if (map_or_code->IsCode()) { |
(...skipping 297 matching lines...) Loading... |
424 RelocInfo::CODE_TARGET, 0); | 427 RelocInfo::CODE_TARGET, 0); |
425 Code* target = Code::GetCodeFromTargetAddress(info.target_address()); | 428 Code* target = Code::GetCodeFromTargetAddress(info.target_address()); |
426 unsigned id = ast_ids[i]; | 429 unsigned id = ast_ids[i]; |
427 InlineCacheState state = target->ic_state(); | 430 InlineCacheState state = target->ic_state(); |
428 Code::Kind kind = target->kind(); | 431 Code::Kind kind = target->kind(); |
429 | 432 |
430 if (kind == Code::TYPE_RECORDING_BINARY_OP_IC || | 433 if (kind == Code::TYPE_RECORDING_BINARY_OP_IC || |
431 kind == Code::COMPARE_IC) { | 434 kind == Code::COMPARE_IC) { |
432 SetInfo(id, target); | 435 SetInfo(id, target); |
433 } else if (state == MONOMORPHIC) { | 436 } else if (state == MONOMORPHIC) { |
434 if (kind == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC || | 437 if (kind == Code::KEYED_LOAD_IC || |
435 kind == Code::KEYED_EXTERNAL_ARRAY_STORE_IC) { | 438 kind == Code::KEYED_STORE_IC) { |
436 SetInfo(id, target); | 439 SetInfo(id, target); |
437 } else if (kind != Code::CALL_IC || | 440 } else if (kind != Code::CALL_IC || |
438 target->check_type() == RECEIVER_MAP_CHECK) { | 441 target->check_type() == RECEIVER_MAP_CHECK) { |
439 Map* map = target->FindFirstMap(); | 442 Map* map = target->FindFirstMap(); |
440 if (map == NULL) { | 443 if (map == NULL) { |
441 SetInfo(id, target); | 444 SetInfo(id, target); |
442 } else { | 445 } else { |
443 SetInfo(id, map); | 446 SetInfo(id, map); |
444 } | 447 } |
445 } else { | 448 } else { |
(...skipping 37 matching lines...) Loading... |
483 static_cast<int>(info->pc() - code->instruction_start())); | 486 static_cast<int>(info->pc() - code->instruction_start())); |
484 ASSERT(ast_ids->length() == 0 || | 487 ASSERT(ast_ids->length() == 0 || |
485 (*ast_ids)[ast_ids->length()-1] != | 488 (*ast_ids)[ast_ids->length()-1] != |
486 static_cast<unsigned>(info->data())); | 489 static_cast<unsigned>(info->data())); |
487 ast_ids->Add(static_cast<unsigned>(info->data())); | 490 ast_ids->Add(static_cast<unsigned>(info->data())); |
488 } | 491 } |
489 } | 492 } |
490 } | 493 } |
491 | 494 |
492 } } // namespace v8::internal | 495 } } // namespace v8::internal |
OLD | NEW |