| 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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 | 1064 |
| 1065 // When generating debug code, make sure the lexical context is set. | 1065 // When generating debug code, make sure the lexical context is set. |
| 1066 if (emit_debug_code()) { | 1066 if (emit_debug_code()) { |
| 1067 cmp(scratch1, Immediate(0)); | 1067 cmp(scratch1, Immediate(0)); |
| 1068 Check(not_equal, kWeShouldNotHaveAnEmptyLexicalContext); | 1068 Check(not_equal, kWeShouldNotHaveAnEmptyLexicalContext); |
| 1069 } | 1069 } |
| 1070 // Load the native context of the current context. | 1070 // Load the native context of the current context. |
| 1071 int offset = | 1071 int offset = |
| 1072 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | 1072 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
| 1073 mov(scratch1, FieldOperand(scratch1, offset)); | 1073 mov(scratch1, FieldOperand(scratch1, offset)); |
| 1074 mov(scratch1, FieldOperand(scratch1, GlobalObject::kNativeContextOffset)); | 1074 mov(scratch1, FieldOperand(scratch1, JSGlobalObject::kNativeContextOffset)); |
| 1075 | 1075 |
| 1076 // Check the context is a native context. | 1076 // Check the context is a native context. |
| 1077 if (emit_debug_code()) { | 1077 if (emit_debug_code()) { |
| 1078 // Read the first word and compare to native_context_map. | 1078 // Read the first word and compare to native_context_map. |
| 1079 cmp(FieldOperand(scratch1, HeapObject::kMapOffset), | 1079 cmp(FieldOperand(scratch1, HeapObject::kMapOffset), |
| 1080 isolate()->factory()->native_context_map()); | 1080 isolate()->factory()->native_context_map()); |
| 1081 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext); | 1081 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 // Check if both contexts are the same. | 1084 // Check if both contexts are the same. |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2079 GetBuiltinFunction(edi, native_context_index); | 2079 GetBuiltinFunction(edi, native_context_index); |
| 2080 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), | 2080 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
| 2081 expected, expected, flag, call_wrapper); | 2081 expected, expected, flag, call_wrapper); |
| 2082 } | 2082 } |
| 2083 | 2083 |
| 2084 | 2084 |
| 2085 void MacroAssembler::GetBuiltinFunction(Register target, | 2085 void MacroAssembler::GetBuiltinFunction(Register target, |
| 2086 int native_context_index) { | 2086 int native_context_index) { |
| 2087 // Load the JavaScript builtin function from the builtins object. | 2087 // Load the JavaScript builtin function from the builtins object. |
| 2088 mov(target, GlobalObjectOperand()); | 2088 mov(target, GlobalObjectOperand()); |
| 2089 mov(target, FieldOperand(target, GlobalObject::kNativeContextOffset)); | 2089 mov(target, FieldOperand(target, JSGlobalObject::kNativeContextOffset)); |
| 2090 mov(target, ContextOperand(target, native_context_index)); | 2090 mov(target, ContextOperand(target, native_context_index)); |
| 2091 } | 2091 } |
| 2092 | 2092 |
| 2093 | 2093 |
| 2094 void MacroAssembler::GetBuiltinEntry(Register target, | 2094 void MacroAssembler::GetBuiltinEntry(Register target, |
| 2095 int native_context_index) { | 2095 int native_context_index) { |
| 2096 DCHECK(!target.is(edi)); | 2096 DCHECK(!target.is(edi)); |
| 2097 // Load the JavaScript builtin function from the builtins object. | 2097 // Load the JavaScript builtin function from the builtins object. |
| 2098 GetBuiltinFunction(edi, native_context_index); | 2098 GetBuiltinFunction(edi, native_context_index); |
| 2099 // Load the code entry point from the function into the target register. | 2099 // Load the code entry point from the function into the target register. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2122 if (emit_debug_code()) { | 2122 if (emit_debug_code()) { |
| 2123 cmp(FieldOperand(dst, HeapObject::kMapOffset), | 2123 cmp(FieldOperand(dst, HeapObject::kMapOffset), |
| 2124 isolate()->factory()->with_context_map()); | 2124 isolate()->factory()->with_context_map()); |
| 2125 Check(not_equal, kVariableResolvedToWithContext); | 2125 Check(not_equal, kVariableResolvedToWithContext); |
| 2126 } | 2126 } |
| 2127 } | 2127 } |
| 2128 | 2128 |
| 2129 | 2129 |
| 2130 void MacroAssembler::LoadGlobalProxy(Register dst) { | 2130 void MacroAssembler::LoadGlobalProxy(Register dst) { |
| 2131 mov(dst, GlobalObjectOperand()); | 2131 mov(dst, GlobalObjectOperand()); |
| 2132 mov(dst, FieldOperand(dst, GlobalObject::kGlobalProxyOffset)); | 2132 mov(dst, FieldOperand(dst, JSGlobalObject::kGlobalProxyOffset)); |
| 2133 } | 2133 } |
| 2134 | 2134 |
| 2135 | 2135 |
| 2136 void MacroAssembler::LoadTransitionedArrayMapConditional( | 2136 void MacroAssembler::LoadTransitionedArrayMapConditional( |
| 2137 ElementsKind expected_kind, | 2137 ElementsKind expected_kind, |
| 2138 ElementsKind transitioned_kind, | 2138 ElementsKind transitioned_kind, |
| 2139 Register map_in_out, | 2139 Register map_in_out, |
| 2140 Register scratch, | 2140 Register scratch, |
| 2141 Label* no_map_match) { | 2141 Label* no_map_match) { |
| 2142 // Load the global or builtins object from the current context. | 2142 // Load the global or builtins object from the current context. |
| 2143 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2143 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 2144 mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); | 2144 mov(scratch, FieldOperand(scratch, JSGlobalObject::kNativeContextOffset)); |
| 2145 | 2145 |
| 2146 // Check that the function's map is the same as the expected cached map. | 2146 // Check that the function's map is the same as the expected cached map. |
| 2147 mov(scratch, Operand(scratch, | 2147 mov(scratch, Operand(scratch, |
| 2148 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 2148 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
| 2149 | 2149 |
| 2150 size_t offset = expected_kind * kPointerSize + | 2150 size_t offset = expected_kind * kPointerSize + |
| 2151 FixedArrayBase::kHeaderSize; | 2151 FixedArrayBase::kHeaderSize; |
| 2152 cmp(map_in_out, FieldOperand(scratch, offset)); | 2152 cmp(map_in_out, FieldOperand(scratch, offset)); |
| 2153 j(not_equal, no_map_match); | 2153 j(not_equal, no_map_match); |
| 2154 | 2154 |
| 2155 // Use the transitioned cached map. | 2155 // Use the transitioned cached map. |
| 2156 offset = transitioned_kind * kPointerSize + | 2156 offset = transitioned_kind * kPointerSize + |
| 2157 FixedArrayBase::kHeaderSize; | 2157 FixedArrayBase::kHeaderSize; |
| 2158 mov(map_in_out, FieldOperand(scratch, offset)); | 2158 mov(map_in_out, FieldOperand(scratch, offset)); |
| 2159 } | 2159 } |
| 2160 | 2160 |
| 2161 | 2161 |
| 2162 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 2162 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
| 2163 // Load the global or builtins object from the current context. | 2163 // Load the global or builtins object from the current context. |
| 2164 mov(function, | 2164 mov(function, |
| 2165 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2165 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 2166 // Load the native context from the global or builtins object. | 2166 // Load the native context from the global or builtins object. |
| 2167 mov(function, | 2167 mov(function, FieldOperand(function, JSGlobalObject::kNativeContextOffset)); |
| 2168 FieldOperand(function, GlobalObject::kNativeContextOffset)); | |
| 2169 // Load the function from the native context. | 2168 // Load the function from the native context. |
| 2170 mov(function, Operand(function, Context::SlotOffset(index))); | 2169 mov(function, Operand(function, Context::SlotOffset(index))); |
| 2171 } | 2170 } |
| 2172 | 2171 |
| 2173 | 2172 |
| 2174 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 2173 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
| 2175 Register map) { | 2174 Register map) { |
| 2176 // Load the initial map. The global functions all have initial maps. | 2175 // Load the initial map. The global functions all have initial maps. |
| 2177 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 2176 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| 2178 if (emit_debug_code()) { | 2177 if (emit_debug_code()) { |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3148 mov(eax, dividend); | 3147 mov(eax, dividend); |
| 3149 shr(eax, 31); | 3148 shr(eax, 31); |
| 3150 add(edx, eax); | 3149 add(edx, eax); |
| 3151 } | 3150 } |
| 3152 | 3151 |
| 3153 | 3152 |
| 3154 } // namespace internal | 3153 } // namespace internal |
| 3155 } // namespace v8 | 3154 } // namespace v8 |
| 3156 | 3155 |
| 3157 #endif // V8_TARGET_ARCH_IA32 | 3156 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |