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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 __ jmp(kScratchRegister); | 103 __ jmp(kScratchRegister); |
104 | 104 |
105 __ bind(&miss); | 105 __ bind(&miss); |
106 } | 106 } |
107 | 107 |
108 | 108 |
109 // Helper function used to check that the dictionary doesn't contain | 109 // Helper function used to check that the dictionary doesn't contain |
110 // the property. This function may return false negatives, so miss_label | 110 // the property. This function may return false negatives, so miss_label |
111 // must always call a backup property check that is complete. | 111 // must always call a backup property check that is complete. |
112 // This function is safe to call if the receiver has fast properties. | 112 // This function is safe to call if the receiver has fast properties. |
113 // Name must be a symbol and receiver must be a heap object. | 113 // Name must be an internalized string and receiver must be a heap object. |
114 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, | 114 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, |
115 Label* miss_label, | 115 Label* miss_label, |
116 Register receiver, | 116 Register receiver, |
117 Handle<String> name, | 117 Handle<String> name, |
118 Register r0, | 118 Register r0, |
119 Register r1) { | 119 Register r1) { |
120 ASSERT(name->IsSymbol()); | 120 ASSERT(name->IsInternalizedString()); |
121 Counters* counters = masm->isolate()->counters(); | 121 Counters* counters = masm->isolate()->counters(); |
122 __ IncrementCounter(counters->negative_lookups(), 1); | 122 __ IncrementCounter(counters->negative_lookups(), 1); |
123 __ IncrementCounter(counters->negative_lookups_miss(), 1); | 123 __ IncrementCounter(counters->negative_lookups_miss(), 1); |
124 | 124 |
125 __ movq(r0, FieldOperand(receiver, HeapObject::kMapOffset)); | 125 __ movq(r0, FieldOperand(receiver, HeapObject::kMapOffset)); |
126 | 126 |
127 const int kInterceptorOrAccessCheckNeededMask = | 127 const int kInterceptorOrAccessCheckNeededMask = |
128 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); | 128 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); |
129 | 129 |
130 // Bail out if the receiver has a named interceptor or requires access checks. | 130 // Bail out if the receiver has a named interceptor or requires access checks. |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 ++depth; | 942 ++depth; |
943 | 943 |
944 // Only global objects and objects that do not require access | 944 // Only global objects and objects that do not require access |
945 // checks are allowed in stubs. | 945 // checks are allowed in stubs. |
946 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); | 946 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); |
947 | 947 |
948 Handle<JSObject> prototype(JSObject::cast(current->GetPrototype())); | 948 Handle<JSObject> prototype(JSObject::cast(current->GetPrototype())); |
949 if (!current->HasFastProperties() && | 949 if (!current->HasFastProperties() && |
950 !current->IsJSGlobalObject() && | 950 !current->IsJSGlobalObject() && |
951 !current->IsJSGlobalProxy()) { | 951 !current->IsJSGlobalProxy()) { |
952 if (!name->IsSymbol()) { | 952 if (!name->IsInternalizedString()) { |
953 name = factory()->LookupSymbol(name); | 953 name = factory()->InternalizeString(name); |
954 } | 954 } |
955 ASSERT(current->property_dictionary()->FindEntry(*name) == | 955 ASSERT(current->property_dictionary()->FindEntry(*name) == |
956 StringDictionary::kNotFound); | 956 StringDictionary::kNotFound); |
957 | 957 |
958 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, | 958 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, |
959 scratch1, scratch2); | 959 scratch1, scratch2); |
960 | 960 |
961 __ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 961 __ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
962 reg = holder_reg; // From now on the object will be in holder_reg. | 962 reg = holder_reg; // From now on the object will be in holder_reg. |
963 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 963 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 index_out_of_range_label, | 1926 index_out_of_range_label, |
1927 STRING_INDEX_IS_NUMBER); | 1927 STRING_INDEX_IS_NUMBER); |
1928 generator.GenerateFast(masm()); | 1928 generator.GenerateFast(masm()); |
1929 __ ret((argc + 1) * kPointerSize); | 1929 __ ret((argc + 1) * kPointerSize); |
1930 | 1930 |
1931 StubRuntimeCallHelper call_helper; | 1931 StubRuntimeCallHelper call_helper; |
1932 generator.GenerateSlow(masm(), call_helper); | 1932 generator.GenerateSlow(masm(), call_helper); |
1933 | 1933 |
1934 if (index_out_of_range.is_linked()) { | 1934 if (index_out_of_range.is_linked()) { |
1935 __ bind(&index_out_of_range); | 1935 __ bind(&index_out_of_range); |
1936 __ LoadRoot(rax, Heap::kEmptyStringRootIndex); | 1936 __ LoadRoot(rax, Heap::kempty_stringRootIndex); |
1937 __ ret((argc + 1) * kPointerSize); | 1937 __ ret((argc + 1) * kPointerSize); |
1938 } | 1938 } |
1939 __ bind(&miss); | 1939 __ bind(&miss); |
1940 // Restore function name in rcx. | 1940 // Restore function name in rcx. |
1941 __ Move(rcx, name); | 1941 __ Move(rcx, name); |
1942 __ bind(&name_miss); | 1942 __ bind(&name_miss); |
1943 GenerateMissBranch(); | 1943 GenerateMissBranch(); |
1944 | 1944 |
1945 // Return the generated code. | 1945 // Return the generated code. |
1946 return GetCode(function); | 1946 return GetCode(function); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 // Patch the receiver on the stack with the global proxy if | 2239 // Patch the receiver on the stack with the global proxy if |
2240 // necessary. | 2240 // necessary. |
2241 if (object->IsGlobalObject()) { | 2241 if (object->IsGlobalObject()) { |
2242 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 2242 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
2243 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 2243 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
2244 } | 2244 } |
2245 break; | 2245 break; |
2246 | 2246 |
2247 case STRING_CHECK: | 2247 case STRING_CHECK: |
2248 if (function->IsBuiltin() || !function->shared()->is_classic_mode()) { | 2248 if (function->IsBuiltin() || !function->shared()->is_classic_mode()) { |
2249 // Check that the object is a two-byte string or a symbol. | 2249 // Check that the object is a two-byte string or an internalized string. |
2250 __ CmpObjectType(rdx, FIRST_NONSTRING_TYPE, rax); | 2250 __ CmpObjectType(rdx, FIRST_NONSTRING_TYPE, rax); |
2251 __ j(above_equal, &miss); | 2251 __ j(above_equal, &miss); |
2252 // Check that the maps starting from the prototype haven't changed. | 2252 // Check that the maps starting from the prototype haven't changed. |
2253 GenerateDirectLoadGlobalFunctionPrototype( | 2253 GenerateDirectLoadGlobalFunctionPrototype( |
2254 masm(), Context::STRING_FUNCTION_INDEX, rax, &miss); | 2254 masm(), Context::STRING_FUNCTION_INDEX, rax, &miss); |
2255 CheckPrototypes( | 2255 CheckPrototypes( |
2256 Handle<JSObject>(JSObject::cast(object->GetPrototype())), | 2256 Handle<JSObject>(JSObject::cast(object->GetPrototype())), |
2257 rax, holder, rbx, rdx, rdi, name, &miss); | 2257 rax, holder, rbx, rdx, rdi, name, &miss); |
2258 } else { | 2258 } else { |
2259 // Calling non-strict non-builtins with a value as the receiver | 2259 // Calling non-strict non-builtins with a value as the receiver |
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3692 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3692 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
3693 } | 3693 } |
3694 } | 3694 } |
3695 | 3695 |
3696 | 3696 |
3697 #undef __ | 3697 #undef __ |
3698 | 3698 |
3699 } } // namespace v8::internal | 3699 } } // namespace v8::internal |
3700 | 3700 |
3701 #endif // V8_TARGET_ARCH_X64 | 3701 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |