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

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

Issue 1316943002: Move (uppercase) JS builtins from js builtins object to native context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove Isolate::js_builtins_object Created 5 years, 3 months 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/ic.h » ('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 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, 2049 void MacroAssembler::InvokeFunction(Handle<JSFunction> function,
2050 const ParameterCount& expected, 2050 const ParameterCount& expected,
2051 const ParameterCount& actual, 2051 const ParameterCount& actual,
2052 InvokeFlag flag, 2052 InvokeFlag flag,
2053 const CallWrapper& call_wrapper) { 2053 const CallWrapper& call_wrapper) {
2054 LoadHeapObject(edi, function); 2054 LoadHeapObject(edi, function);
2055 InvokeFunction(edi, expected, actual, flag, call_wrapper); 2055 InvokeFunction(edi, expected, actual, flag, call_wrapper);
2056 } 2056 }
2057 2057
2058 2058
2059 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, 2059 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag,
2060 InvokeFlag flag,
2061 const CallWrapper& call_wrapper) { 2060 const CallWrapper& call_wrapper) {
2062 // You can't call a builtin without a valid frame. 2061 // You can't call a builtin without a valid frame.
2063 DCHECK(flag == JUMP_FUNCTION || has_frame()); 2062 DCHECK(flag == JUMP_FUNCTION || has_frame());
2064 2063
2065 // Rely on the assertion to check that the number of provided 2064 // Rely on the assertion to check that the number of provided
2066 // arguments match the expected number of arguments. Fake a 2065 // arguments match the expected number of arguments. Fake a
2067 // parameter count to avoid emitting code to do the check. 2066 // parameter count to avoid emitting code to do the check.
2068 ParameterCount expected(0); 2067 ParameterCount expected(0);
2069 GetBuiltinFunction(edi, id); 2068 GetBuiltinFunction(edi, native_context_index);
2070 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), 2069 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset),
2071 expected, expected, flag, call_wrapper); 2070 expected, expected, flag, call_wrapper);
2072 } 2071 }
2073 2072
2074 2073
2075 void MacroAssembler::GetBuiltinFunction(Register target, 2074 void MacroAssembler::GetBuiltinFunction(Register target,
2076 Builtins::JavaScript id) { 2075 int native_context_index) {
2077 // Load the JavaScript builtin function from the builtins object. 2076 // Load the JavaScript builtin function from the builtins object.
2078 mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 2077 mov(target, GlobalObjectOperand());
2079 mov(target, FieldOperand(target, GlobalObject::kBuiltinsOffset)); 2078 mov(target, FieldOperand(target, GlobalObject::kNativeContextOffset));
2080 mov(target, FieldOperand(target, 2079 mov(target, ContextOperand(target, native_context_index));
2081 JSBuiltinsObject::OffsetOfFunctionWithId(id)));
2082 } 2080 }
2083 2081
2084 2082
2085 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { 2083 void MacroAssembler::GetBuiltinEntry(Register target,
2084 int native_context_index) {
2086 DCHECK(!target.is(edi)); 2085 DCHECK(!target.is(edi));
2087 // Load the JavaScript builtin function from the builtins object. 2086 // Load the JavaScript builtin function from the builtins object.
2088 GetBuiltinFunction(edi, id); 2087 GetBuiltinFunction(edi, native_context_index);
2089 // Load the code entry point from the function into the target register. 2088 // Load the code entry point from the function into the target register.
2090 mov(target, FieldOperand(edi, JSFunction::kCodeEntryOffset)); 2089 mov(target, FieldOperand(edi, JSFunction::kCodeEntryOffset));
2091 } 2090 }
2092 2091
2093 2092
2094 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { 2093 void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
2095 if (context_chain_length > 0) { 2094 if (context_chain_length > 0) {
2096 // Move up the chain of contexts to the context containing the slot. 2095 // Move up the chain of contexts to the context containing the slot.
2097 mov(dst, Operand(esi, Context::SlotOffset(Context::PREVIOUS_INDEX))); 2096 mov(dst, Operand(esi, Context::SlotOffset(Context::PREVIOUS_INDEX)));
2098 for (int i = 1; i < context_chain_length; i++) { 2097 for (int i = 1; i < context_chain_length; i++) {
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
3183 mov(eax, dividend); 3182 mov(eax, dividend);
3184 shr(eax, 31); 3183 shr(eax, 31);
3185 add(edx, eax); 3184 add(edx, eax);
3186 } 3185 }
3187 3186
3188 3187
3189 } // namespace internal 3188 } // namespace internal
3190 } // namespace v8 3189 } // namespace v8
3191 3190
3192 #endif // V8_TARGET_ARCH_IA32 3191 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ic/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698