Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 1480003002: [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add patch from Orion for interpreter cementation test. Disable obsolete/invalid tests. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ic/arm/handler-compiler-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 1062
1063 // Load current lexical context from the stack frame. 1063 // Load current lexical context from the stack frame.
1064 mov(scratch1, Operand(ebp, StandardFrameConstants::kContextOffset)); 1064 mov(scratch1, Operand(ebp, StandardFrameConstants::kContextOffset));
1065 1065
1066 // When generating debug code, make sure the lexical context is set. 1066 // When generating debug code, make sure the lexical context is set.
1067 if (emit_debug_code()) { 1067 if (emit_debug_code()) {
1068 cmp(scratch1, Immediate(0)); 1068 cmp(scratch1, Immediate(0));
1069 Check(not_equal, kWeShouldNotHaveAnEmptyLexicalContext); 1069 Check(not_equal, kWeShouldNotHaveAnEmptyLexicalContext);
1070 } 1070 }
1071 // Load the native context of the current context. 1071 // Load the native context of the current context.
1072 int offset = 1072 mov(scratch1, ContextOperand(scratch1, Context::NATIVE_CONTEXT_INDEX));
1073 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
1074 mov(scratch1, FieldOperand(scratch1, offset));
1075 mov(scratch1, FieldOperand(scratch1, JSGlobalObject::kNativeContextOffset));
1076 1073
1077 // Check the context is a native context. 1074 // Check the context is a native context.
1078 if (emit_debug_code()) { 1075 if (emit_debug_code()) {
1079 // Read the first word and compare to native_context_map. 1076 // Read the first word and compare to native_context_map.
1080 cmp(FieldOperand(scratch1, HeapObject::kMapOffset), 1077 cmp(FieldOperand(scratch1, HeapObject::kMapOffset),
1081 isolate()->factory()->native_context_map()); 1078 isolate()->factory()->native_context_map());
1082 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext); 1079 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext);
1083 } 1080 }
1084 1081
1085 // Check if both contexts are the same. 1082 // Check if both contexts are the same.
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 // parameter count to avoid emitting code to do the check. 2121 // parameter count to avoid emitting code to do the check.
2125 ParameterCount expected(0); 2122 ParameterCount expected(0);
2126 GetBuiltinFunction(edi, native_context_index); 2123 GetBuiltinFunction(edi, native_context_index);
2127 InvokeFunctionCode(edi, no_reg, expected, expected, flag, call_wrapper); 2124 InvokeFunctionCode(edi, no_reg, expected, expected, flag, call_wrapper);
2128 } 2125 }
2129 2126
2130 2127
2131 void MacroAssembler::GetBuiltinFunction(Register target, 2128 void MacroAssembler::GetBuiltinFunction(Register target,
2132 int native_context_index) { 2129 int native_context_index) {
2133 // Load the JavaScript builtin function from the builtins object. 2130 // Load the JavaScript builtin function from the builtins object.
2134 mov(target, GlobalObjectOperand()); 2131 mov(target, NativeContextOperand());
2135 mov(target, FieldOperand(target, JSGlobalObject::kNativeContextOffset));
2136 mov(target, ContextOperand(target, native_context_index)); 2132 mov(target, ContextOperand(target, native_context_index));
2137 } 2133 }
2138 2134
2139 2135
2140 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { 2136 void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
2141 if (context_chain_length > 0) { 2137 if (context_chain_length > 0) {
2142 // Move up the chain of contexts to the context containing the slot. 2138 // Move up the chain of contexts to the context containing the slot.
2143 mov(dst, Operand(esi, Context::SlotOffset(Context::PREVIOUS_INDEX))); 2139 mov(dst, Operand(esi, Context::SlotOffset(Context::PREVIOUS_INDEX)));
2144 for (int i = 1; i < context_chain_length; i++) { 2140 for (int i = 1; i < context_chain_length; i++) {
2145 mov(dst, Operand(dst, Context::SlotOffset(Context::PREVIOUS_INDEX))); 2141 mov(dst, Operand(dst, Context::SlotOffset(Context::PREVIOUS_INDEX)));
(...skipping 11 matching lines...) Expand all
2157 // not CONTEXT. 2153 // not CONTEXT.
2158 if (emit_debug_code()) { 2154 if (emit_debug_code()) {
2159 cmp(FieldOperand(dst, HeapObject::kMapOffset), 2155 cmp(FieldOperand(dst, HeapObject::kMapOffset),
2160 isolate()->factory()->with_context_map()); 2156 isolate()->factory()->with_context_map());
2161 Check(not_equal, kVariableResolvedToWithContext); 2157 Check(not_equal, kVariableResolvedToWithContext);
2162 } 2158 }
2163 } 2159 }
2164 2160
2165 2161
2166 void MacroAssembler::LoadGlobalProxy(Register dst) { 2162 void MacroAssembler::LoadGlobalProxy(Register dst) {
2167 mov(dst, GlobalObjectOperand()); 2163 mov(dst, NativeContextOperand());
2168 mov(dst, FieldOperand(dst, JSGlobalObject::kGlobalProxyOffset)); 2164 mov(dst, ContextOperand(dst, Context::GLOBAL_PROXY_INDEX));
2169 } 2165 }
2170 2166
2171 2167
2172 void MacroAssembler::LoadTransitionedArrayMapConditional( 2168 void MacroAssembler::LoadTransitionedArrayMapConditional(
2173 ElementsKind expected_kind, 2169 ElementsKind expected_kind,
2174 ElementsKind transitioned_kind, 2170 ElementsKind transitioned_kind,
2175 Register map_in_out, 2171 Register map_in_out,
2176 Register scratch, 2172 Register scratch,
2177 Label* no_map_match) { 2173 Label* no_map_match) {
2178 // Load the global or builtins object from the current context. 2174 // Load the global or builtins object from the current context.
2179 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 2175 mov(scratch, NativeContextOperand());
2180 mov(scratch, FieldOperand(scratch, JSGlobalObject::kNativeContextOffset));
2181 2176
2182 // Check that the function's map is the same as the expected cached map. 2177 // Check that the function's map is the same as the expected cached map.
2183 mov(scratch, Operand(scratch, 2178 mov(scratch, Operand(scratch,
2184 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); 2179 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX)));
2185 2180
2186 size_t offset = expected_kind * kPointerSize + 2181 size_t offset = expected_kind * kPointerSize +
2187 FixedArrayBase::kHeaderSize; 2182 FixedArrayBase::kHeaderSize;
2188 cmp(map_in_out, FieldOperand(scratch, offset)); 2183 cmp(map_in_out, FieldOperand(scratch, offset));
2189 j(not_equal, no_map_match); 2184 j(not_equal, no_map_match);
2190 2185
2191 // Use the transitioned cached map. 2186 // Use the transitioned cached map.
2192 offset = transitioned_kind * kPointerSize + 2187 offset = transitioned_kind * kPointerSize +
2193 FixedArrayBase::kHeaderSize; 2188 FixedArrayBase::kHeaderSize;
2194 mov(map_in_out, FieldOperand(scratch, offset)); 2189 mov(map_in_out, FieldOperand(scratch, offset));
2195 } 2190 }
2196 2191
2197 2192
2198 void MacroAssembler::LoadGlobalFunction(int index, Register function) { 2193 void MacroAssembler::LoadGlobalFunction(int index, Register function) {
2199 // Load the global or builtins object from the current context. 2194 // Load the native context from the current context.
2200 mov(function, 2195 mov(function, NativeContextOperand());
2201 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
2202 // Load the native context from the global or builtins object.
2203 mov(function, FieldOperand(function, JSGlobalObject::kNativeContextOffset));
2204 // Load the function from the native context. 2196 // Load the function from the native context.
2205 mov(function, Operand(function, Context::SlotOffset(index))); 2197 mov(function, ContextOperand(function, index));
2206 } 2198 }
2207 2199
2208 2200
2209 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, 2201 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
2210 Register map) { 2202 Register map) {
2211 // Load the initial map. The global functions all have initial maps. 2203 // Load the initial map. The global functions all have initial maps.
2212 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 2204 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
2213 if (emit_debug_code()) { 2205 if (emit_debug_code()) {
2214 Label ok, fail; 2206 Label ok, fail;
2215 CheckMap(map, isolate()->factory()->meta_map(), &fail, DO_SMI_CHECK); 2207 CheckMap(map, isolate()->factory()->meta_map(), &fail, DO_SMI_CHECK);
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
3183 mov(eax, dividend); 3175 mov(eax, dividend);
3184 shr(eax, 31); 3176 shr(eax, 31);
3185 add(edx, eax); 3177 add(edx, eax);
3186 } 3178 }
3187 3179
3188 3180
3189 } // namespace internal 3181 } // namespace internal
3190 } // namespace v8 3182 } // namespace v8
3191 3183
3192 #endif // V8_TARGET_ARCH_IA32 3184 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ic/arm/handler-compiler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698