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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 | 1031 |
1032 // When generating debug code, make sure the lexical context is set. | 1032 // When generating debug code, make sure the lexical context is set. |
1033 if (emit_debug_code()) { | 1033 if (emit_debug_code()) { |
1034 cmp(scratch1, Immediate(0)); | 1034 cmp(scratch1, Immediate(0)); |
1035 Check(not_equal, kWeShouldNotHaveAnEmptyLexicalContext); | 1035 Check(not_equal, kWeShouldNotHaveAnEmptyLexicalContext); |
1036 } | 1036 } |
1037 // Load the native context of the current context. | 1037 // Load the native context of the current context. |
1038 int offset = | 1038 int offset = |
1039 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | 1039 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
1040 mov(scratch1, FieldOperand(scratch1, offset)); | 1040 mov(scratch1, FieldOperand(scratch1, offset)); |
1041 mov(scratch1, FieldOperand(scratch1, GlobalObject::kNativeContextOffset)); | 1041 mov(scratch1, FieldOperand(scratch1, JSGlobalObject::kNativeContextOffset)); |
1042 | 1042 |
1043 // Check the context is a native context. | 1043 // Check the context is a native context. |
1044 if (emit_debug_code()) { | 1044 if (emit_debug_code()) { |
1045 // Read the first word and compare to native_context_map. | 1045 // Read the first word and compare to native_context_map. |
1046 cmp(FieldOperand(scratch1, HeapObject::kMapOffset), | 1046 cmp(FieldOperand(scratch1, HeapObject::kMapOffset), |
1047 isolate()->factory()->native_context_map()); | 1047 isolate()->factory()->native_context_map()); |
1048 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext); | 1048 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext); |
1049 } | 1049 } |
1050 | 1050 |
1051 // Check if both contexts are the same. | 1051 // Check if both contexts are the same. |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 GetBuiltinFunction(edi, native_context_index); | 2045 GetBuiltinFunction(edi, native_context_index); |
2046 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), | 2046 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
2047 expected, expected, flag, call_wrapper); | 2047 expected, expected, flag, call_wrapper); |
2048 } | 2048 } |
2049 | 2049 |
2050 | 2050 |
2051 void MacroAssembler::GetBuiltinFunction(Register target, | 2051 void MacroAssembler::GetBuiltinFunction(Register target, |
2052 int native_context_index) { | 2052 int native_context_index) { |
2053 // Load the JavaScript builtin function from the builtins object. | 2053 // Load the JavaScript builtin function from the builtins object. |
2054 mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2054 mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2055 mov(target, FieldOperand(target, GlobalObject::kNativeContextOffset)); | 2055 mov(target, FieldOperand(target, JSGlobalObject::kNativeContextOffset)); |
2056 mov(target, ContextOperand(target, native_context_index)); | 2056 mov(target, ContextOperand(target, native_context_index)); |
2057 } | 2057 } |
2058 | 2058 |
2059 | 2059 |
2060 void MacroAssembler::GetBuiltinEntry(Register target, | 2060 void MacroAssembler::GetBuiltinEntry(Register target, |
2061 int native_context_index) { | 2061 int native_context_index) { |
2062 DCHECK(!target.is(edi)); | 2062 DCHECK(!target.is(edi)); |
2063 // Load the JavaScript builtin function from the builtins object. | 2063 // Load the JavaScript builtin function from the builtins object. |
2064 GetBuiltinFunction(edi, native_context_index); | 2064 GetBuiltinFunction(edi, native_context_index); |
2065 // Load the code entry point from the function into the target register. | 2065 // Load the code entry point from the function into the target register. |
(...skipping 22 matching lines...) Expand all Loading... |
2088 if (emit_debug_code()) { | 2088 if (emit_debug_code()) { |
2089 cmp(FieldOperand(dst, HeapObject::kMapOffset), | 2089 cmp(FieldOperand(dst, HeapObject::kMapOffset), |
2090 isolate()->factory()->with_context_map()); | 2090 isolate()->factory()->with_context_map()); |
2091 Check(not_equal, kVariableResolvedToWithContext); | 2091 Check(not_equal, kVariableResolvedToWithContext); |
2092 } | 2092 } |
2093 } | 2093 } |
2094 | 2094 |
2095 | 2095 |
2096 void MacroAssembler::LoadGlobalProxy(Register dst) { | 2096 void MacroAssembler::LoadGlobalProxy(Register dst) { |
2097 mov(dst, GlobalObjectOperand()); | 2097 mov(dst, GlobalObjectOperand()); |
2098 mov(dst, FieldOperand(dst, GlobalObject::kGlobalProxyOffset)); | 2098 mov(dst, FieldOperand(dst, JSGlobalObject::kGlobalProxyOffset)); |
2099 } | 2099 } |
2100 | 2100 |
2101 | 2101 |
2102 void MacroAssembler::LoadTransitionedArrayMapConditional( | 2102 void MacroAssembler::LoadTransitionedArrayMapConditional( |
2103 ElementsKind expected_kind, | 2103 ElementsKind expected_kind, |
2104 ElementsKind transitioned_kind, | 2104 ElementsKind transitioned_kind, |
2105 Register map_in_out, | 2105 Register map_in_out, |
2106 Register scratch, | 2106 Register scratch, |
2107 Label* no_map_match) { | 2107 Label* no_map_match) { |
2108 // Load the global or builtins object from the current context. | 2108 // Load the global or builtins object from the current context. |
2109 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2109 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2110 mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); | 2110 mov(scratch, FieldOperand(scratch, JSGlobalObject::kNativeContextOffset)); |
2111 | 2111 |
2112 // Check that the function's map is the same as the expected cached map. | 2112 // Check that the function's map is the same as the expected cached map. |
2113 mov(scratch, Operand(scratch, | 2113 mov(scratch, Operand(scratch, |
2114 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 2114 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
2115 | 2115 |
2116 size_t offset = expected_kind * kPointerSize + | 2116 size_t offset = expected_kind * kPointerSize + |
2117 FixedArrayBase::kHeaderSize; | 2117 FixedArrayBase::kHeaderSize; |
2118 cmp(map_in_out, FieldOperand(scratch, offset)); | 2118 cmp(map_in_out, FieldOperand(scratch, offset)); |
2119 j(not_equal, no_map_match); | 2119 j(not_equal, no_map_match); |
2120 | 2120 |
2121 // Use the transitioned cached map. | 2121 // Use the transitioned cached map. |
2122 offset = transitioned_kind * kPointerSize + | 2122 offset = transitioned_kind * kPointerSize + |
2123 FixedArrayBase::kHeaderSize; | 2123 FixedArrayBase::kHeaderSize; |
2124 mov(map_in_out, FieldOperand(scratch, offset)); | 2124 mov(map_in_out, FieldOperand(scratch, offset)); |
2125 } | 2125 } |
2126 | 2126 |
2127 | 2127 |
2128 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 2128 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
2129 // Load the global or builtins object from the current context. | 2129 // Load the global or builtins object from the current context. |
2130 mov(function, | 2130 mov(function, |
2131 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2131 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2132 // Load the native context from the global or builtins object. | 2132 // Load the native context from the global or builtins object. |
2133 mov(function, | 2133 mov(function, FieldOperand(function, JSGlobalObject::kNativeContextOffset)); |
2134 FieldOperand(function, GlobalObject::kNativeContextOffset)); | |
2135 // Load the function from the native context. | 2134 // Load the function from the native context. |
2136 mov(function, Operand(function, Context::SlotOffset(index))); | 2135 mov(function, Operand(function, Context::SlotOffset(index))); |
2137 } | 2136 } |
2138 | 2137 |
2139 | 2138 |
2140 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 2139 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
2141 Register map) { | 2140 Register map) { |
2142 // Load the initial map. The global functions all have initial maps. | 2141 // Load the initial map. The global functions all have initial maps. |
2143 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 2142 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
2144 if (emit_debug_code()) { | 2143 if (emit_debug_code()) { |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3022 mov(eax, dividend); | 3021 mov(eax, dividend); |
3023 shr(eax, 31); | 3022 shr(eax, 31); |
3024 add(edx, eax); | 3023 add(edx, eax); |
3025 } | 3024 } |
3026 | 3025 |
3027 | 3026 |
3028 } // namespace internal | 3027 } // namespace internal |
3029 } // namespace v8 | 3028 } // namespace v8 |
3030 | 3029 |
3031 #endif // V8_TARGET_ARCH_X87 | 3030 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |