OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 __ bind(&miss); | 134 __ bind(&miss); |
135 __ pop(offset); | 135 __ pop(offset); |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 | 139 |
140 // Helper function used to check that the dictionary doesn't contain | 140 // Helper function used to check that the dictionary doesn't contain |
141 // the property. This function may return false negatives, so miss_label | 141 // the property. This function may return false negatives, so miss_label |
142 // must always call a backup property check that is complete. | 142 // must always call a backup property check that is complete. |
143 // This function is safe to call if the receiver has fast properties. | 143 // This function is safe to call if the receiver has fast properties. |
144 // Name must be a symbol and receiver must be a heap object. | 144 // Name must be an internalized string and receiver must be a heap object. |
145 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, | 145 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, |
146 Label* miss_label, | 146 Label* miss_label, |
147 Register receiver, | 147 Register receiver, |
148 Handle<String> name, | 148 Handle<String> name, |
149 Register r0, | 149 Register r0, |
150 Register r1) { | 150 Register r1) { |
151 ASSERT(name->IsSymbol()); | 151 ASSERT(name->IsInternalizedString()); |
152 Counters* counters = masm->isolate()->counters(); | 152 Counters* counters = masm->isolate()->counters(); |
153 __ IncrementCounter(counters->negative_lookups(), 1); | 153 __ IncrementCounter(counters->negative_lookups(), 1); |
154 __ IncrementCounter(counters->negative_lookups_miss(), 1); | 154 __ IncrementCounter(counters->negative_lookups_miss(), 1); |
155 | 155 |
156 __ mov(r0, FieldOperand(receiver, HeapObject::kMapOffset)); | 156 __ mov(r0, FieldOperand(receiver, HeapObject::kMapOffset)); |
157 | 157 |
158 const int kInterceptorOrAccessCheckNeededMask = | 158 const int kInterceptorOrAccessCheckNeededMask = |
159 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); | 159 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); |
160 | 160 |
161 // Bail out if the receiver has a named interceptor or requires access checks. | 161 // Bail out if the receiver has a named interceptor or requires access checks. |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 ++depth; | 965 ++depth; |
966 | 966 |
967 // Only global objects and objects that do not require access | 967 // Only global objects and objects that do not require access |
968 // checks are allowed in stubs. | 968 // checks are allowed in stubs. |
969 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); | 969 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); |
970 | 970 |
971 Handle<JSObject> prototype(JSObject::cast(current->GetPrototype())); | 971 Handle<JSObject> prototype(JSObject::cast(current->GetPrototype())); |
972 if (!current->HasFastProperties() && | 972 if (!current->HasFastProperties() && |
973 !current->IsJSGlobalObject() && | 973 !current->IsJSGlobalObject() && |
974 !current->IsJSGlobalProxy()) { | 974 !current->IsJSGlobalProxy()) { |
975 if (!name->IsSymbol()) { | 975 if (!name->IsInternalizedString()) { |
976 name = factory()->LookupSymbol(name); | 976 name = factory()->InternalizeString(name); |
977 } | 977 } |
978 ASSERT(current->property_dictionary()->FindEntry(*name) == | 978 ASSERT(current->property_dictionary()->FindEntry(*name) == |
979 StringDictionary::kNotFound); | 979 StringDictionary::kNotFound); |
980 | 980 |
981 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, | 981 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, |
982 scratch1, scratch2); | 982 scratch1, scratch2); |
983 | 983 |
984 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 984 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
985 reg = holder_reg; // From now on the object will be in holder_reg. | 985 reg = holder_reg; // From now on the object will be in holder_reg. |
986 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 986 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2415 // Patch the receiver on the stack with the global proxy if | 2415 // Patch the receiver on the stack with the global proxy if |
2416 // necessary. | 2416 // necessary. |
2417 if (object->IsGlobalObject()) { | 2417 if (object->IsGlobalObject()) { |
2418 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); | 2418 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
2419 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); | 2419 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); |
2420 } | 2420 } |
2421 break; | 2421 break; |
2422 | 2422 |
2423 case STRING_CHECK: | 2423 case STRING_CHECK: |
2424 if (function->IsBuiltin() || !function->shared()->is_classic_mode()) { | 2424 if (function->IsBuiltin() || !function->shared()->is_classic_mode()) { |
2425 // Check that the object is a string or a symbol. | 2425 // Check that the object is a string or an internalized string. |
2426 __ CmpObjectType(edx, FIRST_NONSTRING_TYPE, eax); | 2426 __ CmpObjectType(edx, FIRST_NONSTRING_TYPE, eax); |
2427 __ j(above_equal, &miss); | 2427 __ j(above_equal, &miss); |
2428 // Check that the maps starting from the prototype haven't changed. | 2428 // Check that the maps starting from the prototype haven't changed. |
2429 GenerateDirectLoadGlobalFunctionPrototype( | 2429 GenerateDirectLoadGlobalFunctionPrototype( |
2430 masm(), Context::STRING_FUNCTION_INDEX, eax, &miss); | 2430 masm(), Context::STRING_FUNCTION_INDEX, eax, &miss); |
2431 CheckPrototypes( | 2431 CheckPrototypes( |
2432 Handle<JSObject>(JSObject::cast(object->GetPrototype())), | 2432 Handle<JSObject>(JSObject::cast(object->GetPrototype())), |
2433 eax, holder, ebx, edx, edi, name, &miss); | 2433 eax, holder, ebx, edx, edi, name, &miss); |
2434 } else { | 2434 } else { |
2435 // Calling non-strict non-builtins with a value as the receiver | 2435 // Calling non-strict non-builtins with a value as the receiver |
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3917 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3917 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
3918 } | 3918 } |
3919 } | 3919 } |
3920 | 3920 |
3921 | 3921 |
3922 #undef __ | 3922 #undef __ |
3923 | 3923 |
3924 } } // namespace v8::internal | 3924 } } // namespace v8::internal |
3925 | 3925 |
3926 #endif // V8_TARGET_ARCH_IA32 | 3926 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |