| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // Make sure that the code type is not included in the hash. | 75 // Make sure that the code type is not included in the hash. |
| 76 ASSERT(Code::ExtractTypeFromFlags(flags) == 0); | 76 ASSERT(Code::ExtractTypeFromFlags(flags) == 0); |
| 77 | 77 |
| 78 // Compute the primary entry. | 78 // Compute the primary entry. |
| 79 int primary_offset = PrimaryOffset(name, flags, map); | 79 int primary_offset = PrimaryOffset(name, flags, map); |
| 80 Entry* primary = entry(primary_, primary_offset); | 80 Entry* primary = entry(primary_, primary_offset); |
| 81 Code* hit = primary->value; | 81 Code* hit = primary->value; |
| 82 | 82 |
| 83 // If the primary entry has useful data in it, we retire it to the | 83 // If the primary entry has useful data in it, we retire it to the |
| 84 // secondary cache before overwriting it. | 84 // secondary cache before overwriting it. |
| 85 if (hit != Builtins::builtin(Builtins::Illegal)) { | 85 if (hit != Isolate::Current()->builtins()->builtin(Builtins::Illegal)) { |
| 86 Code::Flags primary_flags = Code::RemoveTypeFromFlags(hit->flags()); | 86 Code::Flags primary_flags = Code::RemoveTypeFromFlags(hit->flags()); |
| 87 int secondary_offset = | 87 int secondary_offset = |
| 88 SecondaryOffset(primary->key, primary_flags, primary_offset); | 88 SecondaryOffset(primary->key, primary_flags, primary_offset); |
| 89 Entry* secondary = entry(secondary_, secondary_offset); | 89 Entry* secondary = entry(secondary_, secondary_offset); |
| 90 *secondary = *primary; | 90 *secondary = *primary; |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Update primary cache. | 93 // Update primary cache. |
| 94 primary->key = name; | 94 primary->key = name; |
| 95 primary->value = code; | 95 primary->value = code; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 if (code->IsFailure()) return code; | 196 if (code->IsFailure()) return code; |
| 197 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 197 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
| 198 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 198 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
| 199 if (result->IsFailure()) return result; | 199 if (result->IsFailure()) return result; |
| 200 } | 200 } |
| 201 return code; | 201 return code; |
| 202 } | 202 } |
| 203 | 203 |
| 204 | 204 |
| 205 Object* StubCache::ComputeLoadNormal(String* name, JSObject* receiver) { | 205 Object* StubCache::ComputeLoadNormal(String* name, JSObject* receiver) { |
| 206 return Builtins::builtin(Builtins::LoadIC_Normal); | 206 return Isolate::Current()->builtins()->builtin(Builtins::LoadIC_Normal); |
| 207 } | 207 } |
| 208 | 208 |
| 209 | 209 |
| 210 Object* StubCache::ComputeLoadGlobal(String* name, | 210 Object* StubCache::ComputeLoadGlobal(String* name, |
| 211 JSObject* receiver, | 211 JSObject* receiver, |
| 212 GlobalObject* holder, | 212 GlobalObject* holder, |
| 213 JSGlobalPropertyCell* cell, | 213 JSGlobalPropertyCell* cell, |
| 214 bool is_dont_delete) { | 214 bool is_dont_delete) { |
| 215 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); | 215 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); |
| 216 Object* code = receiver->map()->FindInCodeCache(name, flags); | 216 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 PROFILE(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, | 766 PROFILE(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, |
| 767 code, code->arguments_count())); | 767 code, code->arguments_count())); |
| 768 } | 768 } |
| 769 return result; | 769 return result; |
| 770 } | 770 } |
| 771 | 771 |
| 772 | 772 |
| 773 void StubCache::Clear() { | 773 void StubCache::Clear() { |
| 774 for (int i = 0; i < kPrimaryTableSize; i++) { | 774 for (int i = 0; i < kPrimaryTableSize; i++) { |
| 775 primary_[i].key = HEAP->empty_string(); | 775 primary_[i].key = HEAP->empty_string(); |
| 776 primary_[i].value = Builtins::builtin(Builtins::Illegal); | 776 primary_[i].value = Isolate::Current()->builtins()->builtin( |
| 777 Builtins::Illegal); |
| 777 } | 778 } |
| 778 for (int j = 0; j < kSecondaryTableSize; j++) { | 779 for (int j = 0; j < kSecondaryTableSize; j++) { |
| 779 secondary_[j].key = HEAP->empty_string(); | 780 secondary_[j].key = HEAP->empty_string(); |
| 780 secondary_[j].value = Builtins::builtin(Builtins::Illegal); | 781 secondary_[j].value = Isolate::Current()->builtins()->builtin( |
| 782 Builtins::Illegal); |
| 781 } | 783 } |
| 782 } | 784 } |
| 783 | 785 |
| 784 | 786 |
| 785 // ------------------------------------------------------------------------ | 787 // ------------------------------------------------------------------------ |
| 786 // StubCompiler implementation. | 788 // StubCompiler implementation. |
| 787 | 789 |
| 788 | 790 |
| 789 // Support function for computing call IC miss stubs. | 791 // Support function for computing call IC miss stubs. |
| 790 Handle<Code> ComputeCallMiss(int argc, Code::Kind kind) { | 792 Handle<Code> ComputeCallMiss(int argc, Code::Kind kind) { |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 expected_receiver_type_ = | 1326 expected_receiver_type_ = |
| 1325 FunctionTemplateInfo::cast(signature->receiver()); | 1327 FunctionTemplateInfo::cast(signature->receiver()); |
| 1326 } | 1328 } |
| 1327 } | 1329 } |
| 1328 | 1330 |
| 1329 is_simple_api_call_ = true; | 1331 is_simple_api_call_ = true; |
| 1330 } | 1332 } |
| 1331 | 1333 |
| 1332 | 1334 |
| 1333 } } // namespace v8::internal | 1335 } } // namespace v8::internal |
| OLD | NEW |