| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 | 1079 |
| 1080 // Convert the object to a JS object. | 1080 // Convert the object to a JS object. |
| 1081 Label convert, done_convert; | 1081 Label convert, done_convert; |
| 1082 __ JumpIfSmi(rax, &convert); | 1082 __ JumpIfSmi(rax, &convert); |
| 1083 __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx); | 1083 __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx); |
| 1084 __ j(above_equal, &done_convert); | 1084 __ j(above_equal, &done_convert); |
| 1085 __ bind(&convert); | 1085 __ bind(&convert); |
| 1086 __ Push(rax); | 1086 __ Push(rax); |
| 1087 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1087 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 1088 __ bind(&done_convert); | 1088 __ bind(&done_convert); |
| 1089 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); |
| 1089 __ Push(rax); | 1090 __ Push(rax); |
| 1090 | 1091 |
| 1091 // Check for proxies. | 1092 // Check for proxies. |
| 1092 Label call_runtime; | 1093 Label call_runtime; |
| 1093 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1094 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
| 1094 __ CmpObjectType(rax, LAST_JS_PROXY_TYPE, rcx); | 1095 __ CmpObjectType(rax, LAST_JS_PROXY_TYPE, rcx); |
| 1095 __ j(below_equal, &call_runtime); | 1096 __ j(below_equal, &call_runtime); |
| 1096 | 1097 |
| 1097 // Check cache validity in generated code. This is a fast case for | 1098 // Check cache validity in generated code. This is a fast case for |
| 1098 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 1099 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
| 1099 // guarantee cache validity, call the runtime system to check cache | 1100 // guarantee cache validity, call the runtime system to check cache |
| 1100 // validity or get the property names in a fixed array. | 1101 // validity or get the property names in a fixed array. |
| 1101 __ CheckEnumCache(null_value, &call_runtime); | 1102 __ CheckEnumCache(null_value, &call_runtime); |
| 1102 | 1103 |
| 1103 // The enum cache is valid. Load the map of the object being | 1104 // The enum cache is valid. Load the map of the object being |
| 1104 // iterated over and use the cache for the iteration. | 1105 // iterated over and use the cache for the iteration. |
| 1105 Label use_cache; | 1106 Label use_cache; |
| 1106 __ movp(rax, FieldOperand(rax, HeapObject::kMapOffset)); | 1107 __ movp(rax, FieldOperand(rax, HeapObject::kMapOffset)); |
| 1107 __ jmp(&use_cache, Label::kNear); | 1108 __ jmp(&use_cache, Label::kNear); |
| 1108 | 1109 |
| 1109 // Get the set of properties to enumerate. | 1110 // Get the set of properties to enumerate. |
| 1110 __ bind(&call_runtime); | 1111 __ bind(&call_runtime); |
| 1111 __ Push(rax); // Duplicate the enumerable object on the stack. | 1112 __ Push(rax); // Duplicate the enumerable object on the stack. |
| 1112 __ CallRuntime(Runtime::kGetPropertyNamesFast, 1); | 1113 __ CallRuntime(Runtime::kGetPropertyNamesFast, 1); |
| 1114 PrepareForBailoutForId(stmt->EnumId(), TOS_REG); |
| 1113 | 1115 |
| 1114 // If we got a map from the runtime call, we can do a fast | 1116 // If we got a map from the runtime call, we can do a fast |
| 1115 // modification check. Otherwise, we got a fixed array, and we have | 1117 // modification check. Otherwise, we got a fixed array, and we have |
| 1116 // to do a slow check. | 1118 // to do a slow check. |
| 1117 Label fixed_array; | 1119 Label fixed_array; |
| 1118 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), | 1120 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), |
| 1119 Heap::kMetaMapRootIndex); | 1121 Heap::kMetaMapRootIndex); |
| 1120 __ j(not_equal, &fixed_array); | 1122 __ j(not_equal, &fixed_array); |
| 1121 | 1123 |
| 1122 // We got a map in register rax. Get the enumeration cache from it. | 1124 // We got a map in register rax. Get the enumeration cache from it. |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1658 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
| 1657 } else { | 1659 } else { |
| 1658 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1660 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1659 __ movp(rax, FieldOperand(rdi, JSFunction::kLiteralsOffset)); | 1661 __ movp(rax, FieldOperand(rdi, JSFunction::kLiteralsOffset)); |
| 1660 __ Move(rbx, Smi::FromInt(expr->literal_index())); | 1662 __ Move(rbx, Smi::FromInt(expr->literal_index())); |
| 1661 __ Move(rcx, constant_properties); | 1663 __ Move(rcx, constant_properties); |
| 1662 __ Move(rdx, Smi::FromInt(flags)); | 1664 __ Move(rdx, Smi::FromInt(flags)); |
| 1663 FastCloneShallowObjectStub stub(isolate(), properties_count); | 1665 FastCloneShallowObjectStub stub(isolate(), properties_count); |
| 1664 __ CallStub(&stub); | 1666 __ CallStub(&stub); |
| 1665 } | 1667 } |
| 1668 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
| 1666 | 1669 |
| 1667 // If result_saved is true the result is on top of the stack. If | 1670 // If result_saved is true the result is on top of the stack. If |
| 1668 // result_saved is false the result is in rax. | 1671 // result_saved is false the result is in rax. |
| 1669 bool result_saved = false; | 1672 bool result_saved = false; |
| 1670 | 1673 |
| 1671 // Mark all computed expressions that are bound to a key that | 1674 // Mark all computed expressions that are bound to a key that |
| 1672 // is shadowed by a later occurrence of the same key. For the | 1675 // is shadowed by a later occurrence of the same key. For the |
| 1673 // marked expressions, no store code is emitted. | 1676 // marked expressions, no store code is emitted. |
| 1674 expr->CalculateEmitStore(zone()); | 1677 expr->CalculateEmitStore(zone()); |
| 1675 | 1678 |
| (...skipping 3495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5171 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5174 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5172 Assembler::target_address_at(call_target_address, | 5175 Assembler::target_address_at(call_target_address, |
| 5173 unoptimized_code)); | 5176 unoptimized_code)); |
| 5174 return OSR_AFTER_STACK_CHECK; | 5177 return OSR_AFTER_STACK_CHECK; |
| 5175 } | 5178 } |
| 5176 | 5179 |
| 5177 | 5180 |
| 5178 } } // namespace v8::internal | 5181 } } // namespace v8::internal |
| 5179 | 5182 |
| 5180 #endif // V8_TARGET_ARCH_X64 | 5183 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |