| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 ASSERT(receiver->IsGlobalObject() || receiver->HasFastProperties()); | 100 ASSERT(receiver->IsGlobalObject() || receiver->HasFastProperties()); |
| 101 // If no global objects are present in the prototype chain, the load | 101 // If no global objects are present in the prototype chain, the load |
| 102 // nonexistent IC stub can be shared for all names for a given map | 102 // nonexistent IC stub can be shared for all names for a given map |
| 103 // and we use the empty string for the map cache in that case. If | 103 // and we use the empty string for the map cache in that case. If |
| 104 // there are global objects involved, we need to check global | 104 // there are global objects involved, we need to check global |
| 105 // property cells in the stub and therefore the stub will be | 105 // property cells in the stub and therefore the stub will be |
| 106 // specific to the name. | 106 // specific to the name. |
| 107 String* cache_name = HEAP->empty_string(); | 107 String* cache_name = HEAP->empty_string(); |
| 108 if (receiver->IsGlobalObject()) cache_name = name; | 108 if (receiver->IsGlobalObject()) cache_name = name; |
| 109 JSObject* last = receiver; | 109 JSObject* last = receiver; |
| 110 while (last->GetPrototype() != HEAP->null_value()) { | 110 Heap* heap = HEAP; |
| 111 while (last->GetPrototype() != heap->null_value()) { |
| 111 last = JSObject::cast(last->GetPrototype()); | 112 last = JSObject::cast(last->GetPrototype()); |
| 112 if (last->IsGlobalObject()) cache_name = name; | 113 if (last->IsGlobalObject()) cache_name = name; |
| 113 } | 114 } |
| 114 // Compile the stub that is either shared for all names or | 115 // Compile the stub that is either shared for all names or |
| 115 // name specific if there are global objects involved. | 116 // name specific if there are global objects involved. |
| 116 Code::Flags flags = | 117 Code::Flags flags = |
| 117 Code::ComputeMonomorphicFlags(Code::LOAD_IC, NONEXISTENT); | 118 Code::ComputeMonomorphicFlags(Code::LOAD_IC, NONEXISTENT); |
| 118 Object* code = receiver->map()->FindInCodeCache(cache_name, flags); | 119 Object* code = receiver->map()->FindInCodeCache(cache_name, flags); |
| 119 if (code->IsUndefined()) { | 120 if (code->IsUndefined()) { |
| 120 LoadStubCompiler compiler; | 121 LoadStubCompiler compiler; |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 static Object* GetProbeValue(Code::Flags flags) { | 657 static Object* GetProbeValue(Code::Flags flags) { |
| 657 // Use raw_unchecked... so we don't get assert failures during GC. | 658 // Use raw_unchecked... so we don't get assert failures during GC. |
| 658 NumberDictionary* dictionary = HEAP->raw_unchecked_non_monomorphic_cache(); | 659 NumberDictionary* dictionary = HEAP->raw_unchecked_non_monomorphic_cache(); |
| 659 int entry = dictionary->FindEntry(flags); | 660 int entry = dictionary->FindEntry(flags); |
| 660 if (entry != -1) return dictionary->ValueAt(entry); | 661 if (entry != -1) return dictionary->ValueAt(entry); |
| 661 return HEAP->raw_unchecked_undefined_value(); | 662 return HEAP->raw_unchecked_undefined_value(); |
| 662 } | 663 } |
| 663 | 664 |
| 664 | 665 |
| 665 static Object* ProbeCache(Code::Flags flags) { | 666 static Object* ProbeCache(Code::Flags flags) { |
| 667 Heap* heap = HEAP; |
| 666 Object* probe = GetProbeValue(flags); | 668 Object* probe = GetProbeValue(flags); |
| 667 if (probe != HEAP->undefined_value()) return probe; | 669 if (probe != heap->undefined_value()) return probe; |
| 668 // Seed the cache with an undefined value to make sure that any | 670 // Seed the cache with an undefined value to make sure that any |
| 669 // generated code object can always be inserted into the cache | 671 // generated code object can always be inserted into the cache |
| 670 // without causing allocation failures. | 672 // without causing allocation failures. |
| 671 Object* result = | 673 Object* result = |
| 672 HEAP->non_monomorphic_cache()->AtNumberPut(flags, | 674 heap->non_monomorphic_cache()->AtNumberPut(flags, |
| 673 HEAP->undefined_value()); | 675 heap->undefined_value()); |
| 674 if (result->IsFailure()) return result; | 676 if (result->IsFailure()) return result; |
| 675 HEAP->public_set_non_monomorphic_cache(NumberDictionary::cast(result)); | 677 heap->public_set_non_monomorphic_cache(NumberDictionary::cast(result)); |
| 676 return probe; | 678 return probe; |
| 677 } | 679 } |
| 678 | 680 |
| 679 | 681 |
| 680 static Object* FillCache(Object* code) { | 682 static Object* FillCache(Object* code) { |
| 681 if (code->IsCode()) { | 683 if (code->IsCode()) { |
| 682 int entry = | 684 int entry = |
| 683 HEAP->non_monomorphic_cache()->FindEntry( | 685 HEAP->non_monomorphic_cache()->FindEntry( |
| 684 Code::cast(code)->flags()); | 686 Code::cast(code)->flags()); |
| 685 // The entry must be present see comment in ProbeCache. | 687 // The entry must be present see comment in ProbeCache. |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 } | 1213 } |
| 1212 | 1214 |
| 1213 | 1215 |
| 1214 void StubCompiler::LookupPostInterceptor(JSObject* holder, | 1216 void StubCompiler::LookupPostInterceptor(JSObject* holder, |
| 1215 String* name, | 1217 String* name, |
| 1216 LookupResult* lookup) { | 1218 LookupResult* lookup) { |
| 1217 holder->LocalLookupRealNamedProperty(name, lookup); | 1219 holder->LocalLookupRealNamedProperty(name, lookup); |
| 1218 if (!lookup->IsProperty()) { | 1220 if (!lookup->IsProperty()) { |
| 1219 lookup->NotFound(); | 1221 lookup->NotFound(); |
| 1220 Object* proto = holder->GetPrototype(); | 1222 Object* proto = holder->GetPrototype(); |
| 1221 if (proto != HEAP->null_value()) { | 1223 if (!proto->IsNull()) { |
| 1222 proto->Lookup(name, lookup); | 1224 proto->Lookup(name, lookup); |
| 1223 } | 1225 } |
| 1224 } | 1226 } |
| 1225 } | 1227 } |
| 1226 | 1228 |
| 1227 | 1229 |
| 1228 | 1230 |
| 1229 Object* LoadStubCompiler::GetCode(PropertyType type, String* name) { | 1231 Object* LoadStubCompiler::GetCode(PropertyType type, String* name) { |
| 1230 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, type); | 1232 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, type); |
| 1231 return GetCodeWithFlags(flags, name); | 1233 return GetCodeWithFlags(flags, name); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 expected_receiver_type_ = | 1379 expected_receiver_type_ = |
| 1378 FunctionTemplateInfo::cast(signature->receiver()); | 1380 FunctionTemplateInfo::cast(signature->receiver()); |
| 1379 } | 1381 } |
| 1380 } | 1382 } |
| 1381 | 1383 |
| 1382 is_simple_api_call_ = true; | 1384 is_simple_api_call_ = true; |
| 1383 } | 1385 } |
| 1384 | 1386 |
| 1385 | 1387 |
| 1386 } } // namespace v8::internal | 1388 } } // namespace v8::internal |
| OLD | NEW |