| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // Make sure that the code type is not included in the hash. | 77 // Make sure that the code type is not included in the hash. |
| 78 ASSERT(Code::ExtractTypeFromFlags(flags) == 0); | 78 ASSERT(Code::ExtractTypeFromFlags(flags) == 0); |
| 79 | 79 |
| 80 // Compute the primary entry. | 80 // Compute the primary entry. |
| 81 int primary_offset = PrimaryOffset(name, flags, map); | 81 int primary_offset = PrimaryOffset(name, flags, map); |
| 82 Entry* primary = entry(primary_, primary_offset); | 82 Entry* primary = entry(primary_, primary_offset); |
| 83 Code* hit = primary->value; | 83 Code* hit = primary->value; |
| 84 | 84 |
| 85 // If the primary entry has useful data in it, we retire it to the | 85 // If the primary entry has useful data in it, we retire it to the |
| 86 // secondary cache before overwriting it. | 86 // secondary cache before overwriting it. |
| 87 if (hit != isolate_->builtins()->builtin(Builtins::Illegal)) { | 87 if (hit != isolate_->builtins()->builtin(Builtins::kIllegal)) { |
| 88 Code::Flags primary_flags = Code::RemoveTypeFromFlags(hit->flags()); | 88 Code::Flags primary_flags = Code::RemoveTypeFromFlags(hit->flags()); |
| 89 int secondary_offset = | 89 int secondary_offset = |
| 90 SecondaryOffset(primary->key, primary_flags, primary_offset); | 90 SecondaryOffset(primary->key, primary_flags, primary_offset); |
| 91 Entry* secondary = entry(secondary_, secondary_offset); | 91 Entry* secondary = entry(secondary_, secondary_offset); |
| 92 *secondary = *primary; | 92 *secondary = *primary; |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Update primary cache. | 95 // Update primary cache. |
| 96 primary->key = name; | 96 primary->key = name; |
| 97 primary->value = code; | 97 primary->value = code; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 { MaybeObject* maybe_result = | 238 { MaybeObject* maybe_result = |
| 239 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 239 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
| 240 if (!maybe_result->ToObject(&result)) return maybe_result; | 240 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 return code; | 243 return code; |
| 244 } | 244 } |
| 245 | 245 |
| 246 | 246 |
| 247 MaybeObject* StubCache::ComputeLoadNormal() { | 247 MaybeObject* StubCache::ComputeLoadNormal() { |
| 248 return isolate_->builtins()->builtin(Builtins::LoadIC_Normal); | 248 return isolate_->builtins()->builtin(Builtins::kLoadIC_Normal); |
| 249 } | 249 } |
| 250 | 250 |
| 251 | 251 |
| 252 MaybeObject* StubCache::ComputeLoadGlobal(String* name, | 252 MaybeObject* StubCache::ComputeLoadGlobal(String* name, |
| 253 JSObject* receiver, | 253 JSObject* receiver, |
| 254 GlobalObject* holder, | 254 GlobalObject* holder, |
| 255 JSGlobalPropertyCell* cell, | 255 JSGlobalPropertyCell* cell, |
| 256 bool is_dont_delete) { | 256 bool is_dont_delete) { |
| 257 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 257 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
| 258 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); | 258 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 652 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
| 653 if (!maybe_result->ToObject(&result)) return maybe_result; | 653 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 654 } | 654 } |
| 655 } | 655 } |
| 656 return code; | 656 return code; |
| 657 } | 657 } |
| 658 | 658 |
| 659 | 659 |
| 660 MaybeObject* StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) { | 660 MaybeObject* StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) { |
| 661 return isolate_->builtins()->builtin((strict_mode == kStrictMode) | 661 return isolate_->builtins()->builtin((strict_mode == kStrictMode) |
| 662 ? Builtins::StoreIC_Normal_Strict | 662 ? Builtins::kStoreIC_Normal_Strict |
| 663 : Builtins::StoreIC_Normal); | 663 : Builtins::kStoreIC_Normal); |
| 664 } | 664 } |
| 665 | 665 |
| 666 | 666 |
| 667 MaybeObject* StubCache::ComputeStoreGlobal(String* name, | 667 MaybeObject* StubCache::ComputeStoreGlobal(String* name, |
| 668 GlobalObject* receiver, | 668 GlobalObject* receiver, |
| 669 JSGlobalPropertyCell* cell, | 669 JSGlobalPropertyCell* cell, |
| 670 StrictModeFlag strict_mode) { | 670 StrictModeFlag strict_mode) { |
| 671 Code::Flags flags = Code::ComputeMonomorphicFlags( | 671 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 672 Code::STORE_IC, NORMAL, strict_mode); | 672 Code::STORE_IC, NORMAL, strict_mode); |
| 673 Object* code = receiver->map()->FindInCodeCache(name, flags); | 673 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 StubCompiler compiler; | 1214 StubCompiler compiler; |
| 1215 return FillCache(isolate_, compiler.CompileCallDebugPrepareStepIn(flags)); | 1215 return FillCache(isolate_, compiler.CompileCallDebugPrepareStepIn(flags)); |
| 1216 } | 1216 } |
| 1217 #endif | 1217 #endif |
| 1218 | 1218 |
| 1219 | 1219 |
| 1220 void StubCache::Clear() { | 1220 void StubCache::Clear() { |
| 1221 for (int i = 0; i < kPrimaryTableSize; i++) { | 1221 for (int i = 0; i < kPrimaryTableSize; i++) { |
| 1222 primary_[i].key = isolate_->heap()->empty_string(); | 1222 primary_[i].key = isolate_->heap()->empty_string(); |
| 1223 primary_[i].value = isolate_->builtins()->builtin( | 1223 primary_[i].value = isolate_->builtins()->builtin( |
| 1224 Builtins::Illegal); | 1224 Builtins::kIllegal); |
| 1225 } | 1225 } |
| 1226 for (int j = 0; j < kSecondaryTableSize; j++) { | 1226 for (int j = 0; j < kSecondaryTableSize; j++) { |
| 1227 secondary_[j].key = isolate_->heap()->empty_string(); | 1227 secondary_[j].key = isolate_->heap()->empty_string(); |
| 1228 secondary_[j].value = isolate_->builtins()->builtin( | 1228 secondary_[j].value = isolate_->builtins()->builtin( |
| 1229 Builtins::Illegal); | 1229 Builtins::kIllegal); |
| 1230 } | 1230 } |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 | 1233 |
| 1234 void StubCache::CollectMatchingMaps(ZoneMapList* types, | 1234 void StubCache::CollectMatchingMaps(ZoneMapList* types, |
| 1235 String* name, | 1235 String* name, |
| 1236 Code::Flags flags) { | 1236 Code::Flags flags) { |
| 1237 for (int i = 0; i < kPrimaryTableSize; i++) { | 1237 for (int i = 0; i < kPrimaryTableSize; i++) { |
| 1238 if (primary_[i].key == name) { | 1238 if (primary_[i].key == name) { |
| 1239 Map* map = primary_[i].value->FindFirstMap(); | 1239 Map* map = primary_[i].value->FindFirstMap(); |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1937 } | 1937 } |
| 1938 Code* code = Code::cast(result); | 1938 Code* code = Code::cast(result); |
| 1939 USE(code); | 1939 USE(code); |
| 1940 PROFILE(isolate(), | 1940 PROFILE(isolate(), |
| 1941 CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); | 1941 CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); |
| 1942 return result; | 1942 return result; |
| 1943 } | 1943 } |
| 1944 | 1944 |
| 1945 | 1945 |
| 1946 } } // namespace v8::internal | 1946 } } // namespace v8::internal |
| OLD | NEW |