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

Side by Side Diff: src/x64/code-stubs-x64.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/x64/builtins-x64.cc ('k') | src/x64/macro-assembler-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 // Push arguments below the return address to prepare jump to builtin. 1758 // Push arguments below the return address to prepare jump to builtin.
1759 __ PopReturnAddressTo(rcx); 1759 __ PopReturnAddressTo(rcx);
1760 __ Push(rdx); 1760 __ Push(rdx);
1761 __ Push(rax); 1761 __ Push(rax);
1762 1762
1763 // Figure out which native to call and setup the arguments. 1763 // Figure out which native to call and setup the arguments.
1764 if (cc == equal && strict()) { 1764 if (cc == equal && strict()) {
1765 __ PushReturnAddressFrom(rcx); 1765 __ PushReturnAddressFrom(rcx);
1766 __ TailCallRuntime(Runtime::kStrictEquals, 2, 1); 1766 __ TailCallRuntime(Runtime::kStrictEquals, 2, 1);
1767 } else { 1767 } else {
1768 Builtins::JavaScript builtin; 1768 int context_index;
1769 if (cc == equal) { 1769 if (cc == equal) {
1770 builtin = Builtins::EQUALS; 1770 context_index = Context::EQUALS_BUILTIN_INDEX;
1771 } else { 1771 } else {
1772 builtin = 1772 context_index = is_strong(strength())
1773 is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; 1773 ? Context::COMPARE_STRONG_BUILTIN_INDEX
1774 : Context::COMPARE_BUILTIN_INDEX;
1774 __ Push(Smi::FromInt(NegativeComparisonResult(cc))); 1775 __ Push(Smi::FromInt(NegativeComparisonResult(cc)));
1775 } 1776 }
1776 1777
1777 __ PushReturnAddressFrom(rcx); 1778 __ PushReturnAddressFrom(rcx);
1778 1779
1779 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) 1780 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater)
1780 // tagged as a small integer. 1781 // tagged as a small integer.
1781 __ InvokeBuiltin(builtin, JUMP_FUNCTION); 1782 __ InvokeBuiltin(context_index, JUMP_FUNCTION);
1782 } 1783 }
1783 1784
1784 __ bind(&miss); 1785 __ bind(&miss);
1785 GenerateMiss(masm); 1786 GenerateMiss(masm);
1786 } 1787 }
1787 1788
1788 1789
1789 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, 1790 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub,
1790 bool is_super) { 1791 bool is_super) {
1791 // rax : number of arguments to the construct function 1792 // rax : number of arguments to the construct function
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 int argc, 1935 int argc,
1935 Label* non_function) { 1936 Label* non_function) {
1936 // Check for function proxy. 1937 // Check for function proxy.
1937 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); 1938 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE);
1938 __ j(not_equal, non_function); 1939 __ j(not_equal, non_function);
1939 __ PopReturnAddressTo(rcx); 1940 __ PopReturnAddressTo(rcx);
1940 __ Push(rdi); // put proxy as additional argument under return address 1941 __ Push(rdi); // put proxy as additional argument under return address
1941 __ PushReturnAddressFrom(rcx); 1942 __ PushReturnAddressFrom(rcx);
1942 __ Set(rax, argc + 1); 1943 __ Set(rax, argc + 1);
1943 __ Set(rbx, 0); 1944 __ Set(rbx, 0);
1944 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); 1945 __ GetBuiltinEntry(rdx, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX);
1945 { 1946 {
1946 Handle<Code> adaptor = 1947 Handle<Code> adaptor =
1947 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); 1948 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
1948 __ jmp(adaptor, RelocInfo::CODE_TARGET); 1949 __ jmp(adaptor, RelocInfo::CODE_TARGET);
1949 } 1950 }
1950 1951
1951 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 1952 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
1952 // of the original receiver from the call site). 1953 // of the original receiver from the call site).
1953 __ bind(non_function); 1954 __ bind(non_function);
1954 __ movp(args->GetReceiverOperand(), rdi); 1955 __ movp(args->GetReceiverOperand(), rdi);
1955 __ Set(rax, argc); 1956 __ Set(rax, argc);
1956 __ Set(rbx, 0); 1957 __ Set(rbx, 0);
1957 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION); 1958 __ GetBuiltinEntry(rdx, Context::CALL_NON_FUNCTION_BUILTIN_INDEX);
1958 Handle<Code> adaptor = 1959 Handle<Code> adaptor =
1959 isolate->builtins()->ArgumentsAdaptorTrampoline(); 1960 isolate->builtins()->ArgumentsAdaptorTrampoline();
1960 __ Jump(adaptor, RelocInfo::CODE_TARGET); 1961 __ Jump(adaptor, RelocInfo::CODE_TARGET);
1961 } 1962 }
1962 1963
1963 1964
1964 static void EmitWrapCase(MacroAssembler* masm, 1965 static void EmitWrapCase(MacroAssembler* masm,
1965 StackArgumentsAccessor* args, 1966 StackArgumentsAccessor* args,
1966 Label* cont) { 1967 Label* cont) {
1967 // Wrap the receiver and patch it back onto the stack. 1968 // Wrap the receiver and patch it back onto the stack.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 __ leap(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize)); 2092 __ leap(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize));
2092 __ jmp(jmp_reg); 2093 __ jmp(jmp_reg);
2093 2094
2094 // rdi: called object 2095 // rdi: called object
2095 // rax: number of arguments 2096 // rax: number of arguments
2096 // r11: object map 2097 // r11: object map
2097 Label do_call; 2098 Label do_call;
2098 __ bind(&slow); 2099 __ bind(&slow);
2099 __ CmpInstanceType(r11, JS_FUNCTION_PROXY_TYPE); 2100 __ CmpInstanceType(r11, JS_FUNCTION_PROXY_TYPE);
2100 __ j(not_equal, &non_function_call); 2101 __ j(not_equal, &non_function_call);
2101 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); 2102 __ GetBuiltinEntry(rdx,
2103 Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX);
2102 __ jmp(&do_call); 2104 __ jmp(&do_call);
2103 2105
2104 __ bind(&non_function_call); 2106 __ bind(&non_function_call);
2105 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 2107 __ GetBuiltinEntry(rdx,
2108 Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX);
2106 __ bind(&do_call); 2109 __ bind(&do_call);
2107 // Set expected number of arguments to zero (not changing rax). 2110 // Set expected number of arguments to zero (not changing rax).
2108 __ Set(rbx, 0); 2111 __ Set(rbx, 0);
2109 __ Jump(isolate()->builtins()->ArgumentsAdaptorTrampoline(), 2112 __ Jump(isolate()->builtins()->ArgumentsAdaptorTrampoline(),
2110 RelocInfo::CODE_TARGET); 2113 RelocInfo::CODE_TARGET);
2111 } 2114 }
2112 2115
2113 2116
2114 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { 2117 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
2115 __ movp(vector, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 2118 __ movp(vector, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
3214 Label not_oddball; 3217 Label not_oddball;
3215 __ CmpInstanceType(rdi, ODDBALL_TYPE); 3218 __ CmpInstanceType(rdi, ODDBALL_TYPE);
3216 __ j(not_equal, &not_oddball, Label::kNear); 3219 __ j(not_equal, &not_oddball, Label::kNear);
3217 __ movp(rax, FieldOperand(rax, Oddball::kToNumberOffset)); 3220 __ movp(rax, FieldOperand(rax, Oddball::kToNumberOffset));
3218 __ Ret(); 3221 __ Ret();
3219 __ bind(&not_oddball); 3222 __ bind(&not_oddball);
3220 3223
3221 __ PopReturnAddressTo(rcx); // Pop return address. 3224 __ PopReturnAddressTo(rcx); // Pop return address.
3222 __ Push(rax); // Push argument. 3225 __ Push(rax); // Push argument.
3223 __ PushReturnAddressFrom(rcx); // Push return address. 3226 __ PushReturnAddressFrom(rcx); // Push return address.
3224 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); 3227 __ InvokeBuiltin(Context::TO_NUMBER_BUILTIN_INDEX, JUMP_FUNCTION);
3225 } 3228 }
3226 3229
3227 3230
3228 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, 3231 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm,
3229 Register left, 3232 Register left,
3230 Register right, 3233 Register right,
3231 Register scratch1, 3234 Register scratch1,
3232 Register scratch2) { 3235 Register scratch2) {
3233 Register length = scratch1; 3236 Register length = scratch1;
3234 3237
(...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after
5474 kStackSpace, nullptr, return_value_operand, NULL); 5477 kStackSpace, nullptr, return_value_operand, NULL);
5475 } 5478 }
5476 5479
5477 5480
5478 #undef __ 5481 #undef __
5479 5482
5480 } // namespace internal 5483 } // namespace internal
5481 } // namespace v8 5484 } // namespace v8
5482 5485
5483 #endif // V8_TARGET_ARCH_X64 5486 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698