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

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

Issue 1481353002: X87: [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/x87/macro-assembler-x87.h ('k') | no next file » | 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_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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 1028
1029 // Load current lexical context from the stack frame. 1029 // Load current lexical context from the stack frame.
1030 mov(scratch1, Operand(ebp, StandardFrameConstants::kContextOffset)); 1030 mov(scratch1, Operand(ebp, StandardFrameConstants::kContextOffset));
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 mov(scratch1, ContextOperand(scratch1, Context::NATIVE_CONTEXT_INDEX));
1039 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
1040 mov(scratch1, FieldOperand(scratch1, offset));
1041 mov(scratch1, FieldOperand(scratch1, JSGlobalObject::kNativeContextOffset));
1042 1039
1043 // Check the context is a native context. 1040 // Check the context is a native context.
1044 if (emit_debug_code()) { 1041 if (emit_debug_code()) {
1045 // Read the first word and compare to native_context_map. 1042 // Read the first word and compare to native_context_map.
1046 cmp(FieldOperand(scratch1, HeapObject::kMapOffset), 1043 cmp(FieldOperand(scratch1, HeapObject::kMapOffset),
1047 isolate()->factory()->native_context_map()); 1044 isolate()->factory()->native_context_map());
1048 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext); 1045 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext);
1049 } 1046 }
1050 1047
1051 // Check if both contexts are the same. 1048 // Check if both contexts are the same.
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
2088 // parameter count to avoid emitting code to do the check. 2085 // parameter count to avoid emitting code to do the check.
2089 ParameterCount expected(0); 2086 ParameterCount expected(0);
2090 GetBuiltinFunction(edi, native_context_index); 2087 GetBuiltinFunction(edi, native_context_index);
2091 InvokeFunctionCode(edi, no_reg, expected, expected, flag, call_wrapper); 2088 InvokeFunctionCode(edi, no_reg, expected, expected, flag, call_wrapper);
2092 } 2089 }
2093 2090
2094 2091
2095 void MacroAssembler::GetBuiltinFunction(Register target, 2092 void MacroAssembler::GetBuiltinFunction(Register target,
2096 int native_context_index) { 2093 int native_context_index) {
2097 // Load the JavaScript builtin function from the builtins object. 2094 // Load the JavaScript builtin function from the builtins object.
2098 mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 2095 mov(target, NativeContextOperand());
2099 mov(target, FieldOperand(target, JSGlobalObject::kNativeContextOffset));
2100 mov(target, ContextOperand(target, native_context_index)); 2096 mov(target, ContextOperand(target, native_context_index));
2101 } 2097 }
2102 2098
2103 2099
2104 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { 2100 void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
2105 if (context_chain_length > 0) { 2101 if (context_chain_length > 0) {
2106 // Move up the chain of contexts to the context containing the slot. 2102 // Move up the chain of contexts to the context containing the slot.
2107 mov(dst, Operand(esi, Context::SlotOffset(Context::PREVIOUS_INDEX))); 2103 mov(dst, Operand(esi, Context::SlotOffset(Context::PREVIOUS_INDEX)));
2108 for (int i = 1; i < context_chain_length; i++) { 2104 for (int i = 1; i < context_chain_length; i++) {
2109 mov(dst, Operand(dst, Context::SlotOffset(Context::PREVIOUS_INDEX))); 2105 mov(dst, Operand(dst, Context::SlotOffset(Context::PREVIOUS_INDEX)));
(...skipping 11 matching lines...) Expand all
2121 // not CONTEXT. 2117 // not CONTEXT.
2122 if (emit_debug_code()) { 2118 if (emit_debug_code()) {
2123 cmp(FieldOperand(dst, HeapObject::kMapOffset), 2119 cmp(FieldOperand(dst, HeapObject::kMapOffset),
2124 isolate()->factory()->with_context_map()); 2120 isolate()->factory()->with_context_map());
2125 Check(not_equal, kVariableResolvedToWithContext); 2121 Check(not_equal, kVariableResolvedToWithContext);
2126 } 2122 }
2127 } 2123 }
2128 2124
2129 2125
2130 void MacroAssembler::LoadGlobalProxy(Register dst) { 2126 void MacroAssembler::LoadGlobalProxy(Register dst) {
2131 mov(dst, GlobalObjectOperand()); 2127 mov(dst, NativeContextOperand());
2132 mov(dst, FieldOperand(dst, JSGlobalObject::kGlobalProxyOffset)); 2128 mov(dst, ContextOperand(dst, Context::GLOBAL_PROXY_INDEX));
2133 } 2129 }
2134 2130
2135 2131
2136 void MacroAssembler::LoadTransitionedArrayMapConditional( 2132 void MacroAssembler::LoadTransitionedArrayMapConditional(
2137 ElementsKind expected_kind, 2133 ElementsKind expected_kind,
2138 ElementsKind transitioned_kind, 2134 ElementsKind transitioned_kind,
2139 Register map_in_out, 2135 Register map_in_out,
2140 Register scratch, 2136 Register scratch,
2141 Label* no_map_match) { 2137 Label* no_map_match) {
2142 // Load the global or builtins object from the current context. 2138 // Load the global or builtins object from the current context.
2143 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 2139 mov(scratch, NativeContextOperand());
2144 mov(scratch, FieldOperand(scratch, JSGlobalObject::kNativeContextOffset));
2145 2140
2146 // Check that the function's map is the same as the expected cached map. 2141 // Check that the function's map is the same as the expected cached map.
2147 mov(scratch, Operand(scratch, 2142 mov(scratch, Operand(scratch,
2148 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); 2143 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX)));
2149 2144
2150 size_t offset = expected_kind * kPointerSize + 2145 size_t offset = expected_kind * kPointerSize +
2151 FixedArrayBase::kHeaderSize; 2146 FixedArrayBase::kHeaderSize;
2152 cmp(map_in_out, FieldOperand(scratch, offset)); 2147 cmp(map_in_out, FieldOperand(scratch, offset));
2153 j(not_equal, no_map_match); 2148 j(not_equal, no_map_match);
2154 2149
2155 // Use the transitioned cached map. 2150 // Use the transitioned cached map.
2156 offset = transitioned_kind * kPointerSize + 2151 offset = transitioned_kind * kPointerSize +
2157 FixedArrayBase::kHeaderSize; 2152 FixedArrayBase::kHeaderSize;
2158 mov(map_in_out, FieldOperand(scratch, offset)); 2153 mov(map_in_out, FieldOperand(scratch, offset));
2159 } 2154 }
2160 2155
2161 2156
2162 void MacroAssembler::LoadGlobalFunction(int index, Register function) { 2157 void MacroAssembler::LoadGlobalFunction(int index, Register function) {
2163 // Load the global or builtins object from the current context. 2158 // Load the native context from the current context.
2164 mov(function, 2159 mov(function, NativeContextOperand());
2165 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
2166 // Load the native context from the global or builtins object.
2167 mov(function, FieldOperand(function, JSGlobalObject::kNativeContextOffset));
2168 // Load the function from the native context. 2160 // Load the function from the native context.
2169 mov(function, Operand(function, Context::SlotOffset(index))); 2161 mov(function, ContextOperand(function, index));
2170 } 2162 }
2171 2163
2172 2164
2173 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, 2165 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
2174 Register map) { 2166 Register map) {
2175 // Load the initial map. The global functions all have initial maps. 2167 // Load the initial map. The global functions all have initial maps.
2176 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 2168 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
2177 if (emit_debug_code()) { 2169 if (emit_debug_code()) {
2178 Label ok, fail; 2170 Label ok, fail;
2179 CheckMap(map, isolate()->factory()->meta_map(), &fail, DO_SMI_CHECK); 2171 CheckMap(map, isolate()->factory()->meta_map(), &fail, DO_SMI_CHECK);
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
3055 mov(eax, dividend); 3047 mov(eax, dividend);
3056 shr(eax, 31); 3048 shr(eax, 31);
3057 add(edx, eax); 3049 add(edx, eax);
3058 } 3050 }
3059 3051
3060 3052
3061 } // namespace internal 3053 } // namespace internal
3062 } // namespace v8 3054 } // namespace v8
3063 3055
3064 #endif // V8_TARGET_ARCH_X87 3056 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/macro-assembler-x87.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698