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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 1335723002: [stubs] Simplify the non-function case of CallConstructStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michi's comment. 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/runtime.js ('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 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 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 Register jmp_reg = rcx; 2034 Register jmp_reg = rcx;
2035 __ movp(jmp_reg, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); 2035 __ movp(jmp_reg, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
2036 __ movp(jmp_reg, FieldOperand(jmp_reg, 2036 __ movp(jmp_reg, FieldOperand(jmp_reg,
2037 SharedFunctionInfo::kConstructStubOffset)); 2037 SharedFunctionInfo::kConstructStubOffset));
2038 __ leap(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize)); 2038 __ leap(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize));
2039 __ jmp(jmp_reg); 2039 __ jmp(jmp_reg);
2040 2040
2041 // rdi: called object 2041 // rdi: called object
2042 // rax: number of arguments 2042 // rax: number of arguments
2043 // r11: object map 2043 // r11: object map
2044 Label do_call;
2045 __ bind(&slow); 2044 __ bind(&slow);
2046 __ CmpInstanceType(r11, JS_FUNCTION_PROXY_TYPE); 2045 {
2047 __ j(not_equal, &non_function_call); 2046 __ CmpInstanceType(r11, JS_FUNCTION_PROXY_TYPE);
2048 __ GetBuiltinEntry(rdx, 2047 __ j(not_equal, &non_function_call, Label::kNear);
2049 Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX);
2050 __ jmp(&do_call);
2051 2048
2052 __ bind(&non_function_call); 2049 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
2053 __ GetBuiltinEntry(rdx, 2050 __ movp(rdi, FieldOperand(rdi, JSFunctionProxy::kConstructTrapOffset));
2054 Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX); 2051 __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
2055 __ bind(&do_call); 2052
2056 // Set expected number of arguments to zero (not changing rax). 2053 __ bind(&non_function_call);
2057 __ Set(rbx, 0); 2054 {
2058 __ Jump(isolate()->builtins()->ArgumentsAdaptorTrampoline(), 2055 // Determine the delegate for the target (if any).
2059 RelocInfo::CODE_TARGET); 2056 FrameScope scope(masm, StackFrame::INTERNAL);
2057 __ Integer32ToSmi(rax, rax);
2058 __ Push(rax);
2059 __ Push(rdi);
2060 __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
2061 __ movp(rdi, rax);
2062 __ Pop(rax);
2063 __ SmiToInteger32(rax, rax);
2064 }
2065 // The delegate is always a regular function.
2066 __ AssertFunction(rdi);
2067 __ Jump(isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET);
2068 }
2060 } 2069 }
2061 2070
2062 2071
2063 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { 2072 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
2064 __ movp(vector, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 2073 __ movp(vector, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
2065 __ movp(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); 2074 __ movp(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset));
2066 __ movp(vector, FieldOperand(vector, 2075 __ movp(vector, FieldOperand(vector,
2067 SharedFunctionInfo::kFeedbackVectorOffset)); 2076 SharedFunctionInfo::kFeedbackVectorOffset));
2068 } 2077 }
2069 2078
(...skipping 3504 matching lines...) Expand 10 before | Expand all | Expand 10 after
5574 kStackSpace, nullptr, return_value_operand, NULL); 5583 kStackSpace, nullptr, return_value_operand, NULL);
5575 } 5584 }
5576 5585
5577 5586
5578 #undef __ 5587 #undef __
5579 5588
5580 } // namespace internal 5589 } // namespace internal
5581 } // namespace v8 5590 } // namespace v8
5582 5591
5583 #endif // V8_TARGET_ARCH_X64 5592 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698