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

Side by Side Diff: src/x87/macro-assembler-x87.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
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 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, 2014 void MacroAssembler::InvokeFunction(Handle<JSFunction> function,
2015 const ParameterCount& expected, 2015 const ParameterCount& expected,
2016 const ParameterCount& actual, 2016 const ParameterCount& actual,
2017 InvokeFlag flag, 2017 InvokeFlag flag,
2018 const CallWrapper& call_wrapper) { 2018 const CallWrapper& call_wrapper) {
2019 LoadHeapObject(edi, function); 2019 LoadHeapObject(edi, function);
2020 InvokeFunction(edi, expected, actual, flag, call_wrapper); 2020 InvokeFunction(edi, expected, actual, flag, call_wrapper);
2021 } 2021 }
2022 2022
2023 2023
2024 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, 2024 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag,
2025 InvokeFlag flag,
2026 const CallWrapper& call_wrapper) { 2025 const CallWrapper& call_wrapper) {
2027 // You can't call a builtin without a valid frame. 2026 // You can't call a builtin without a valid frame.
2028 DCHECK(flag == JUMP_FUNCTION || has_frame()); 2027 DCHECK(flag == JUMP_FUNCTION || has_frame());
2029 2028
2030 // Rely on the assertion to check that the number of provided 2029 // Rely on the assertion to check that the number of provided
2031 // arguments match the expected number of arguments. Fake a 2030 // arguments match the expected number of arguments. Fake a
2032 // parameter count to avoid emitting code to do the check. 2031 // parameter count to avoid emitting code to do the check.
2033 ParameterCount expected(0); 2032 ParameterCount expected(0);
2034 GetBuiltinFunction(edi, id); 2033 GetBuiltinFunction(edi, native_context_index);
2035 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), 2034 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset),
2036 expected, expected, flag, call_wrapper); 2035 expected, expected, flag, call_wrapper);
2037 } 2036 }
2038 2037
2039 2038
2040 void MacroAssembler::GetBuiltinFunction(Register target, 2039 void MacroAssembler::GetBuiltinFunction(Register target,
2041 Builtins::JavaScript id) { 2040 int native_context_index) {
2042 // Load the JavaScript builtin function from the builtins object. 2041 // Load the JavaScript builtin function from the builtins object.
2043 mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 2042 mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
2044 mov(target, FieldOperand(target, GlobalObject::kBuiltinsOffset)); 2043 mov(target, FieldOperand(target, GlobalObject::kNativeContextOffset));
2045 mov(target, FieldOperand(target, 2044 mov(target, ContextOperand(target, native_context_index));
2046 JSBuiltinsObject::OffsetOfFunctionWithId(id)));
2047 } 2045 }
2048 2046
2049 2047
2050 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { 2048 void MacroAssembler::GetBuiltinEntry(Register target,
2049 int native_context_index) {
2051 DCHECK(!target.is(edi)); 2050 DCHECK(!target.is(edi));
2052 // Load the JavaScript builtin function from the builtins object. 2051 // Load the JavaScript builtin function from the builtins object.
2053 GetBuiltinFunction(edi, id); 2052 GetBuiltinFunction(edi, native_context_index);
2054 // Load the code entry point from the function into the target register. 2053 // Load the code entry point from the function into the target register.
2055 mov(target, FieldOperand(edi, JSFunction::kCodeEntryOffset)); 2054 mov(target, FieldOperand(edi, JSFunction::kCodeEntryOffset));
2056 } 2055 }
2057 2056
2058 2057
2059 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { 2058 void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
2060 if (context_chain_length > 0) { 2059 if (context_chain_length > 0) {
2061 // Move up the chain of contexts to the context containing the slot. 2060 // Move up the chain of contexts to the context containing the slot.
2062 mov(dst, Operand(esi, Context::SlotOffset(Context::PREVIOUS_INDEX))); 2061 mov(dst, Operand(esi, Context::SlotOffset(Context::PREVIOUS_INDEX)));
2063 for (int i = 1; i < context_chain_length; i++) { 2062 for (int i = 1; i < context_chain_length; i++) {
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
3060 mov(eax, dividend); 3059 mov(eax, dividend);
3061 shr(eax, 31); 3060 shr(eax, 31);
3062 add(edx, eax); 3061 add(edx, eax);
3063 } 3062 }
3064 3063
3065 3064
3066 } // namespace internal 3065 } // namespace internal
3067 } // namespace v8 3066 } // namespace v8
3068 3067
3069 #endif // V8_TARGET_ARCH_X87 3068 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/macro-assembler-x87.h ('k') | test/unittests/compiler/interpreter-assembler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698