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

Unified Diff: src/ia32/builtins-ia32.cc

Issue 1552473002: Revert of [runtime] Introduce dedicated JSBoundFunction to represent bound functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@FunctionConstructor
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/builtins-ia32.cc
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc
index 827a4c4f43656a31a225bdc8476cddbcbe82fddf..00403078cd18b1bfabbf714f18fcce50112b01f5 100644
--- a/src/ia32/builtins-ia32.cc
+++ b/src/ia32/builtins-ia32.cc
@@ -1766,117 +1766,6 @@
}
-namespace {
-
-void Generate_PushBoundArguments(MacroAssembler* masm) {
- // ----------- S t a t e -------------
- // -- eax : the number of arguments (not including the receiver)
- // -- edx : new.target (only in case of [[Construct]])
- // -- edi : target (checked to be a JSBoundFunction)
- // -----------------------------------
-
- // Load [[BoundArguments]] into ecx and length of that into ebx.
- Label no_bound_arguments;
- __ mov(ecx, FieldOperand(edi, JSBoundFunction::kBoundArgumentsOffset));
- __ mov(ebx, FieldOperand(ecx, FixedArray::kLengthOffset));
- __ SmiUntag(ebx);
- __ test(ebx, ebx);
- __ j(zero, &no_bound_arguments);
- {
- // ----------- S t a t e -------------
- // -- eax : the number of arguments (not including the receiver)
- // -- edx : new.target (only in case of [[Construct]])
- // -- edi : target (checked to be a JSBoundFunction)
- // -- ecx : the [[BoundArguments]] (implemented as FixedArray)
- // -- ebx : the number of [[BoundArguments]]
- // -----------------------------------
-
- // Reserve stack space for the [[BoundArguments]].
- {
- Label done;
- __ lea(ecx, Operand(ebx, times_pointer_size, 0));
- __ sub(esp, ecx);
- // Check the stack for overflow. We are not trying to catch interruptions
- // (i.e. debug break and preemption) here, so check the "real stack
- // limit".
- __ CompareRoot(esp, ecx, Heap::kRealStackLimitRootIndex);
- __ j(greater, &done, Label::kNear); // Signed comparison.
- // Restore the stack pointer.
- __ lea(esp, Operand(esp, ebx, times_pointer_size, 0));
- {
- FrameScope scope(masm, StackFrame::MANUAL);
- __ EnterFrame(StackFrame::INTERNAL);
- __ CallRuntime(Runtime::kThrowStackOverflow, 0);
- }
- __ bind(&done);
- }
-
- // Adjust effective number of arguments to include return address.
- __ inc(eax);
-
- // Relocate arguments and return address down the stack.
- {
- Label loop;
- __ Set(ecx, 0);
- __ lea(ebx, Operand(esp, ebx, times_pointer_size, 0));
- __ bind(&loop);
- __ movd(xmm0, Operand(ebx, ecx, times_pointer_size, 0));
- __ movd(Operand(esp, ecx, times_pointer_size, 0), xmm0);
- __ inc(ecx);
- __ cmp(ecx, eax);
- __ j(less, &loop);
- }
-
- // Copy [[BoundArguments]] to the stack (below the arguments).
- {
- Label loop;
- __ mov(ecx, FieldOperand(edi, JSBoundFunction::kBoundArgumentsOffset));
- __ mov(ebx, FieldOperand(ecx, FixedArray::kLengthOffset));
- __ SmiUntag(ebx);
- __ bind(&loop);
- __ dec(ebx);
- __ movd(xmm0, FieldOperand(ecx, ebx, times_pointer_size,
- FixedArray::kHeaderSize));
- __ movd(Operand(esp, eax, times_pointer_size, 0), xmm0);
- __ lea(eax, Operand(eax, 1));
- __ j(greater, &loop);
- }
-
- // Adjust effective number of arguments (eax contains the number of
- // arguments from the call plus return address plus the number of
- // [[BoundArguments]]), so we need to subtract one for the return address.
- __ dec(eax);
- }
- __ bind(&no_bound_arguments);
-}
-
-} // namespace
-
-
-// static
-void Builtins::Generate_CallBoundFunction(MacroAssembler* masm) {
- // ----------- S t a t e -------------
- // -- eax : the number of arguments (not including the receiver)
- // -- edi : the function to call (checked to be a JSBoundFunction)
- // -----------------------------------
- __ AssertBoundFunction(edi);
-
- // Patch the receiver to [[BoundThis]].
- __ mov(ebx, FieldOperand(edi, JSBoundFunction::kBoundThisOffset));
- __ mov(Operand(esp, eax, times_pointer_size, kPointerSize), ebx);
-
- // Push the [[BoundArguments]] onto the stack.
- Generate_PushBoundArguments(masm);
-
- // Call the [[BoundTargetFunction]] via the Call builtin.
- __ mov(edi, FieldOperand(edi, JSBoundFunction::kBoundTargetFunctionOffset));
- __ mov(ecx, Operand::StaticVariable(ExternalReference(
- Builtins::kCall_ReceiverIsAny, masm->isolate())));
- __ lea(ecx, FieldOperand(ecx, Code::kHeaderSize));
- __ jmp(ecx);
-}
-
-
// static
void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
// ----------- S t a t e -------------
@@ -1889,9 +1778,6 @@
__ bind(&non_smi);
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
__ j(equal, masm->isolate()->builtins()->CallFunction(mode),
- RelocInfo::CODE_TARGET);
- __ CmpInstanceType(ecx, JS_BOUND_FUNCTION_TYPE);
- __ j(equal, masm->isolate()->builtins()->CallBoundFunction(),
RelocInfo::CODE_TARGET);
__ CmpInstanceType(ecx, JS_PROXY_TYPE);
__ j(not_equal, &non_function);
@@ -1954,36 +1840,6 @@
// static
-void Builtins::Generate_ConstructBoundFunction(MacroAssembler* masm) {
- // ----------- S t a t e -------------
- // -- eax : the number of arguments (not including the receiver)
- // -- edx : the new target (checked to be a constructor)
- // -- edi : the constructor to call (checked to be a JSBoundFunction)
- // -----------------------------------
- __ AssertBoundFunction(edi);
-
- // Push the [[BoundArguments]] onto the stack.
- Generate_PushBoundArguments(masm);
-
- // Patch new.target to [[BoundTargetFunction]] if new.target equals target.
- {
- Label done;
- __ cmp(edi, edx);
- __ j(not_equal, &done, Label::kNear);
- __ mov(edx, FieldOperand(edi, JSBoundFunction::kBoundTargetFunctionOffset));
- __ bind(&done);
- }
-
- // Construct the [[BoundTargetFunction]] via the Construct builtin.
- __ mov(edi, FieldOperand(edi, JSBoundFunction::kBoundTargetFunctionOffset));
- __ mov(ecx, Operand::StaticVariable(
- ExternalReference(Builtins::kConstruct, masm->isolate())));
- __ lea(ecx, FieldOperand(ecx, Code::kHeaderSize));
- __ jmp(ecx);
-}
-
-
-// static
void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- eax : the number of arguments (not including the receiver)
@@ -2026,12 +1882,6 @@
// Check if target has a [[Construct]] internal method.
__ test_b(FieldOperand(ecx, Map::kBitFieldOffset), 1 << Map::kIsConstructor);
__ j(zero, &non_constructor, Label::kNear);
-
- // Only dispatch to bound functions after checking whether they are
- // constructors.
- __ CmpInstanceType(ecx, JS_BOUND_FUNCTION_TYPE);
- __ j(equal, masm->isolate()->builtins()->ConstructBoundFunction(),
- RelocInfo::CODE_TARGET);
// Only dispatch to proxies after checking whether they are constructors.
__ CmpInstanceType(ecx, JS_PROXY_TYPE);
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698