| 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 | 1055 |
| 1056 // Convert the object to a JS object. | 1056 // Convert the object to a JS object. |
| 1057 Label convert, done_convert; | 1057 Label convert, done_convert; |
| 1058 __ JumpIfSmi(eax, &convert, Label::kNear); | 1058 __ JumpIfSmi(eax, &convert, Label::kNear); |
| 1059 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); | 1059 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 1060 __ j(above_equal, &done_convert, Label::kNear); | 1060 __ j(above_equal, &done_convert, Label::kNear); |
| 1061 __ bind(&convert); | 1061 __ bind(&convert); |
| 1062 __ push(eax); | 1062 __ push(eax); |
| 1063 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1063 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 1064 __ bind(&done_convert); | 1064 __ bind(&done_convert); |
| 1065 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); |
| 1065 __ push(eax); | 1066 __ push(eax); |
| 1066 | 1067 |
| 1067 // Check for proxies. | 1068 // Check for proxies. |
| 1068 Label call_runtime, use_cache, fixed_array; | 1069 Label call_runtime, use_cache, fixed_array; |
| 1069 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1070 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
| 1070 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); | 1071 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); |
| 1071 __ j(below_equal, &call_runtime); | 1072 __ j(below_equal, &call_runtime); |
| 1072 | 1073 |
| 1073 // Check cache validity in generated code. This is a fast case for | 1074 // Check cache validity in generated code. This is a fast case for |
| 1074 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 1075 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
| 1075 // guarantee cache validity, call the runtime system to check cache | 1076 // guarantee cache validity, call the runtime system to check cache |
| 1076 // validity or get the property names in a fixed array. | 1077 // validity or get the property names in a fixed array. |
| 1077 __ CheckEnumCache(&call_runtime); | 1078 __ CheckEnumCache(&call_runtime); |
| 1078 | 1079 |
| 1079 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); | 1080 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); |
| 1080 __ jmp(&use_cache, Label::kNear); | 1081 __ jmp(&use_cache, Label::kNear); |
| 1081 | 1082 |
| 1082 // Get the set of properties to enumerate. | 1083 // Get the set of properties to enumerate. |
| 1083 __ bind(&call_runtime); | 1084 __ bind(&call_runtime); |
| 1084 __ push(eax); | 1085 __ push(eax); |
| 1085 __ CallRuntime(Runtime::kGetPropertyNamesFast, 1); | 1086 __ CallRuntime(Runtime::kGetPropertyNamesFast, 1); |
| 1087 PrepareForBailoutForId(stmt->EnumId(), TOS_REG); |
| 1086 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), | 1088 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), |
| 1087 isolate()->factory()->meta_map()); | 1089 isolate()->factory()->meta_map()); |
| 1088 __ j(not_equal, &fixed_array); | 1090 __ j(not_equal, &fixed_array); |
| 1089 | 1091 |
| 1090 | 1092 |
| 1091 // We got a map in register eax. Get the enumeration cache from it. | 1093 // We got a map in register eax. Get the enumeration cache from it. |
| 1092 Label no_descriptors; | 1094 Label no_descriptors; |
| 1093 __ bind(&use_cache); | 1095 __ bind(&use_cache); |
| 1094 | 1096 |
| 1095 __ EnumLength(edx, eax); | 1097 __ EnumLength(edx, eax); |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1624 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
| 1623 } else { | 1625 } else { |
| 1624 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1626 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1625 __ mov(eax, FieldOperand(edi, JSFunction::kLiteralsOffset)); | 1627 __ mov(eax, FieldOperand(edi, JSFunction::kLiteralsOffset)); |
| 1626 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); | 1628 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); |
| 1627 __ mov(ecx, Immediate(constant_properties)); | 1629 __ mov(ecx, Immediate(constant_properties)); |
| 1628 __ mov(edx, Immediate(Smi::FromInt(flags))); | 1630 __ mov(edx, Immediate(Smi::FromInt(flags))); |
| 1629 FastCloneShallowObjectStub stub(isolate(), properties_count); | 1631 FastCloneShallowObjectStub stub(isolate(), properties_count); |
| 1630 __ CallStub(&stub); | 1632 __ CallStub(&stub); |
| 1631 } | 1633 } |
| 1634 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
| 1632 | 1635 |
| 1633 // If result_saved is true the result is on top of the stack. If | 1636 // If result_saved is true the result is on top of the stack. If |
| 1634 // result_saved is false the result is in eax. | 1637 // result_saved is false the result is in eax. |
| 1635 bool result_saved = false; | 1638 bool result_saved = false; |
| 1636 | 1639 |
| 1637 // Mark all computed expressions that are bound to a key that | 1640 // Mark all computed expressions that are bound to a key that |
| 1638 // is shadowed by a later occurrence of the same key. For the | 1641 // is shadowed by a later occurrence of the same key. For the |
| 1639 // marked expressions, no store code is emitted. | 1642 // marked expressions, no store code is emitted. |
| 1640 expr->CalculateEmitStore(zone()); | 1643 expr->CalculateEmitStore(zone()); |
| 1641 | 1644 |
| (...skipping 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5156 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5159 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5157 Assembler::target_address_at(call_target_address, | 5160 Assembler::target_address_at(call_target_address, |
| 5158 unoptimized_code)); | 5161 unoptimized_code)); |
| 5159 return OSR_AFTER_STACK_CHECK; | 5162 return OSR_AFTER_STACK_CHECK; |
| 5160 } | 5163 } |
| 5161 | 5164 |
| 5162 | 5165 |
| 5163 } } // namespace v8::internal | 5166 } } // namespace v8::internal |
| 5164 | 5167 |
| 5165 #endif // V8_TARGET_ARCH_IA32 | 5168 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |