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

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

Issue 1478303002: Revert of [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: 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 mov(scratch1, ContextOperand(scratch1, Context::NATIVE_CONTEXT_INDEX)); 1072 int offset =
1073 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
1074 mov(scratch1, FieldOperand(scratch1, offset));
1075 mov(scratch1, FieldOperand(scratch1, JSGlobalObject::kNativeContextOffset));
1073 1076
1074 // Check the context is a native context. 1077 // Check the context is a native context.
1075 if (emit_debug_code()) { 1078 if (emit_debug_code()) {
1076 // Read the first word and compare to native_context_map. 1079 // Read the first word and compare to native_context_map.
1077 cmp(FieldOperand(scratch1, HeapObject::kMapOffset), 1080 cmp(FieldOperand(scratch1, HeapObject::kMapOffset),
1078 isolate()->factory()->native_context_map()); 1081 isolate()->factory()->native_context_map());
1079 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext); 1082 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext);
1080 } 1083 }
1081 1084
1082 // Check if both contexts are the same. 1085 // Check if both contexts are the same.
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
2121 // parameter count to avoid emitting code to do the check. 2124 // parameter count to avoid emitting code to do the check.
2122 ParameterCount expected(0); 2125 ParameterCount expected(0);
2123 GetBuiltinFunction(edi, native_context_index); 2126 GetBuiltinFunction(edi, native_context_index);
2124 InvokeFunctionCode(edi, no_reg, expected, expected, flag, call_wrapper); 2127 InvokeFunctionCode(edi, no_reg, expected, expected, flag, call_wrapper);
2125 } 2128 }
2126 2129
2127 2130
2128 void MacroAssembler::GetBuiltinFunction(Register target, 2131 void MacroAssembler::GetBuiltinFunction(Register target,
2129 int native_context_index) { 2132 int native_context_index) {
2130 // Load the JavaScript builtin function from the builtins object. 2133 // Load the JavaScript builtin function from the builtins object.
2131 mov(target, NativeContextOperand()); 2134 mov(target, GlobalObjectOperand());
2135 mov(target, FieldOperand(target, JSGlobalObject::kNativeContextOffset));
2132 mov(target, ContextOperand(target, native_context_index)); 2136 mov(target, ContextOperand(target, native_context_index));
2133 } 2137 }
2134 2138
2135 2139
2136 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { 2140 void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
2137 if (context_chain_length > 0) { 2141 if (context_chain_length > 0) {
2138 // Move up the chain of contexts to the context containing the slot. 2142 // Move up the chain of contexts to the context containing the slot.
2139 mov(dst, Operand(esi, Context::SlotOffset(Context::PREVIOUS_INDEX))); 2143 mov(dst, Operand(esi, Context::SlotOffset(Context::PREVIOUS_INDEX)));
2140 for (int i = 1; i < context_chain_length; i++) { 2144 for (int i = 1; i < context_chain_length; i++) {
2141 mov(dst, Operand(dst, Context::SlotOffset(Context::PREVIOUS_INDEX))); 2145 mov(dst, Operand(dst, Context::SlotOffset(Context::PREVIOUS_INDEX)));
(...skipping 11 matching lines...) Expand all
2153 // not CONTEXT. 2157 // not CONTEXT.
2154 if (emit_debug_code()) { 2158 if (emit_debug_code()) {
2155 cmp(FieldOperand(dst, HeapObject::kMapOffset), 2159 cmp(FieldOperand(dst, HeapObject::kMapOffset),
2156 isolate()->factory()->with_context_map()); 2160 isolate()->factory()->with_context_map());
2157 Check(not_equal, kVariableResolvedToWithContext); 2161 Check(not_equal, kVariableResolvedToWithContext);
2158 } 2162 }
2159 } 2163 }
2160 2164
2161 2165
2162 void MacroAssembler::LoadGlobalProxy(Register dst) { 2166 void MacroAssembler::LoadGlobalProxy(Register dst) {
2163 mov(dst, NativeContextOperand()); 2167 mov(dst, GlobalObjectOperand());
2164 mov(dst, ContextOperand(dst, Context::GLOBAL_PROXY_INDEX)); 2168 mov(dst, FieldOperand(dst, JSGlobalObject::kGlobalProxyOffset));
2165 } 2169 }
2166 2170
2167 2171
2168 void MacroAssembler::LoadTransitionedArrayMapConditional( 2172 void MacroAssembler::LoadTransitionedArrayMapConditional(
2169 ElementsKind expected_kind, 2173 ElementsKind expected_kind,
2170 ElementsKind transitioned_kind, 2174 ElementsKind transitioned_kind,
2171 Register map_in_out, 2175 Register map_in_out,
2172 Register scratch, 2176 Register scratch,
2173 Label* no_map_match) { 2177 Label* no_map_match) {
2174 // Load the global or builtins object from the current context. 2178 // Load the global or builtins object from the current context.
2175 mov(scratch, NativeContextOperand()); 2179 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
2180 mov(scratch, FieldOperand(scratch, JSGlobalObject::kNativeContextOffset));
2176 2181
2177 // Check that the function's map is the same as the expected cached map. 2182 // Check that the function's map is the same as the expected cached map.
2178 mov(scratch, Operand(scratch, 2183 mov(scratch, Operand(scratch,
2179 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); 2184 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX)));
2180 2185
2181 size_t offset = expected_kind * kPointerSize + 2186 size_t offset = expected_kind * kPointerSize +
2182 FixedArrayBase::kHeaderSize; 2187 FixedArrayBase::kHeaderSize;
2183 cmp(map_in_out, FieldOperand(scratch, offset)); 2188 cmp(map_in_out, FieldOperand(scratch, offset));
2184 j(not_equal, no_map_match); 2189 j(not_equal, no_map_match);
2185 2190
2186 // Use the transitioned cached map. 2191 // Use the transitioned cached map.
2187 offset = transitioned_kind * kPointerSize + 2192 offset = transitioned_kind * kPointerSize +
2188 FixedArrayBase::kHeaderSize; 2193 FixedArrayBase::kHeaderSize;
2189 mov(map_in_out, FieldOperand(scratch, offset)); 2194 mov(map_in_out, FieldOperand(scratch, offset));
2190 } 2195 }
2191 2196
2192 2197
2193 void MacroAssembler::LoadGlobalFunction(int index, Register function) { 2198 void MacroAssembler::LoadGlobalFunction(int index, Register function) {
2194 // Load the native context from the current context. 2199 // Load the global or builtins object from the current context.
2195 mov(function, NativeContextOperand()); 2200 mov(function,
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));
2196 // Load the function from the native context. 2204 // Load the function from the native context.
2197 mov(function, ContextOperand(function, index)); 2205 mov(function, Operand(function, Context::SlotOffset(index)));
2198 } 2206 }
2199 2207
2200 2208
2201 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, 2209 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
2202 Register map) { 2210 Register map) {
2203 // Load the initial map. The global functions all have initial maps. 2211 // Load the initial map. The global functions all have initial maps.
2204 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 2212 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
2205 if (emit_debug_code()) { 2213 if (emit_debug_code()) {
2206 Label ok, fail; 2214 Label ok, fail;
2207 CheckMap(map, isolate()->factory()->meta_map(), &fail, DO_SMI_CHECK); 2215 CheckMap(map, isolate()->factory()->meta_map(), &fail, DO_SMI_CHECK);
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 mov(eax, dividend); 3183 mov(eax, dividend);
3176 shr(eax, 31); 3184 shr(eax, 31);
3177 add(edx, eax); 3185 add(edx, eax);
3178 } 3186 }
3179 3187
3180 3188
3181 } // namespace internal 3189 } // namespace internal
3182 } // namespace v8 3190 } // namespace v8
3183 3191
3184 #endif // V8_TARGET_ARCH_IA32 3192 #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