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

Side by Side Diff: src/x87/builtins-x87.cc

Issue 1774353002: X87: [runtime] Unify and simplify how frames are marked. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/ic/x87/handler-compiler-x87.cc ('k') | src/x87/code-stubs-x87.cc » ('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_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 __ bind(&ok); 116 __ bind(&ok);
117 GenerateTailCallToSharedCode(masm); 117 GenerateTailCallToSharedCode(masm);
118 } 118 }
119 119
120 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 120 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
121 bool is_api_function, 121 bool is_api_function,
122 bool create_implicit_receiver, 122 bool create_implicit_receiver,
123 bool check_derived_construct) { 123 bool check_derived_construct) {
124 // ----------- S t a t e ------------- 124 // ----------- S t a t e -------------
125 // -- eax: number of arguments 125 // -- eax: number of arguments
126 // -- esi: context
126 // -- edi: constructor function 127 // -- edi: constructor function
127 // -- ebx: allocation site or undefined 128 // -- ebx: allocation site or undefined
128 // -- edx: new target 129 // -- edx: new target
129 // ----------------------------------- 130 // -----------------------------------
130 131
131 // Enter a construct frame. 132 // Enter a construct frame.
132 { 133 {
133 FrameScope scope(masm, StackFrame::CONSTRUCT); 134 FrameScope scope(masm, StackFrame::CONSTRUCT);
134 135
135 // Preserve the incoming parameters on the stack. 136 // Preserve the incoming parameters on the stack.
136 __ AssertUndefinedOrAllocationSite(ebx); 137 __ AssertUndefinedOrAllocationSite(ebx);
138 __ push(esi);
137 __ push(ebx); 139 __ push(ebx);
138 __ SmiTag(eax); 140 __ SmiTag(eax);
139 __ push(eax); 141 __ push(eax);
140 142
141 if (create_implicit_receiver) { 143 if (create_implicit_receiver) {
142 // Allocate the new receiver object. 144 // Allocate the new receiver object.
143 __ Push(edi); 145 __ Push(edi);
144 __ Push(edx); 146 __ Push(edx);
145 FastNewObjectStub stub(masm->isolate()); 147 FastNewObjectStub stub(masm->isolate());
146 __ CallStub(&stub); 148 __ CallStub(&stub);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 __ InvokeFunction(edi, edx, actual, CALL_FUNCTION, 196 __ InvokeFunction(edi, edx, actual, CALL_FUNCTION,
195 CheckDebugStepCallWrapper()); 197 CheckDebugStepCallWrapper());
196 } 198 }
197 199
198 // Store offset of return address for deoptimizer. 200 // Store offset of return address for deoptimizer.
199 if (create_implicit_receiver && !is_api_function) { 201 if (create_implicit_receiver && !is_api_function) {
200 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); 202 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset());
201 } 203 }
202 204
203 // Restore context from the frame. 205 // Restore context from the frame.
204 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 206 __ mov(esi, Operand(ebp, ConstructFrameConstants::kContextOffset));
205 207
206 if (create_implicit_receiver) { 208 if (create_implicit_receiver) {
207 // If the result is an object (in the ECMA sense), we should get rid 209 // If the result is an object (in the ECMA sense), we should get rid
208 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 210 // of the receiver and use the result; see ECMA-262 section 13.2.2-7
209 // on page 74. 211 // on page 74.
210 Label use_receiver, exit; 212 Label use_receiver, exit;
211 213
212 // If the result is a smi, it is *not* an object in the ECMA sense. 214 // If the result is a smi, it is *not* an object in the ECMA sense.
213 __ JumpIfSmi(eax, &use_receiver); 215 __ JumpIfSmi(eax, &use_receiver);
214 216
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 __ CallRuntime(Runtime::kThrowStackOverflow); 320 __ CallRuntime(Runtime::kThrowStackOverflow);
319 321
320 __ bind(&okay); 322 __ bind(&okay);
321 } 323 }
322 324
323 325
324 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, 326 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
325 bool is_construct) { 327 bool is_construct) {
326 ProfileEntryHookStub::MaybeCallEntryHook(masm); 328 ProfileEntryHookStub::MaybeCallEntryHook(masm);
327 329
328 // Clear the context before we push it when entering the internal frame.
329 __ Move(esi, Immediate(0));
330
331 { 330 {
332 FrameScope scope(masm, StackFrame::INTERNAL); 331 FrameScope scope(masm, StackFrame::INTERNAL);
333 332
334 // Setup the context (we need to use the caller context from the isolate). 333 // Setup the context (we need to use the caller context from the isolate).
335 ExternalReference context_address(Isolate::kContextAddress, 334 ExternalReference context_address(Isolate::kContextAddress,
336 masm->isolate()); 335 masm->isolate());
337 __ mov(esi, Operand::StaticVariable(context_address)); 336 __ mov(esi, Operand::StaticVariable(context_address));
338 337
339 // Load the previous frame pointer (ebx) to access C arguments 338 // Load the previous frame pointer (ebx) to access C arguments
340 __ mov(ebx, Operand(ebp, 0)); 339 __ mov(ebx, Operand(ebp, 0));
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 Label done; 1891 Label done;
1893 ExternalReference debug_is_active = 1892 ExternalReference debug_is_active =
1894 ExternalReference::debug_is_active_address(masm->isolate()); 1893 ExternalReference::debug_is_active_address(masm->isolate());
1895 __ movzx_b(scratch1, Operand::StaticVariable(debug_is_active)); 1894 __ movzx_b(scratch1, Operand::StaticVariable(debug_is_active));
1896 __ cmp(scratch1, Immediate(0)); 1895 __ cmp(scratch1, Immediate(0));
1897 __ j(not_equal, &done, Label::kNear); 1896 __ j(not_equal, &done, Label::kNear);
1898 1897
1899 // Drop possible interpreter handler/stub frame. 1898 // Drop possible interpreter handler/stub frame.
1900 { 1899 {
1901 Label no_interpreter_frame; 1900 Label no_interpreter_frame;
1902 __ cmp(Operand(ebp, StandardFrameConstants::kMarkerOffset), 1901 __ cmp(Operand(ebp, CommonFrameConstants::kContextOrFrameTypeOffset),
1903 Immediate(Smi::FromInt(StackFrame::STUB))); 1902 Immediate(Smi::FromInt(StackFrame::STUB)));
1904 __ j(not_equal, &no_interpreter_frame, Label::kNear); 1903 __ j(not_equal, &no_interpreter_frame, Label::kNear);
1905 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 1904 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
1906 __ bind(&no_interpreter_frame); 1905 __ bind(&no_interpreter_frame);
1907 } 1906 }
1908 1907
1909 // Check if next frame is an arguments adaptor frame. 1908 // Check if next frame is an arguments adaptor frame.
1910 Register caller_args_count_reg = scratch1; 1909 Register caller_args_count_reg = scratch1;
1911 Label no_arguments_adaptor, formal_parameter_count_loaded; 1910 Label no_arguments_adaptor, formal_parameter_count_loaded;
1912 __ mov(scratch2, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 1911 __ mov(scratch2, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
1913 __ cmp(Operand(scratch2, StandardFrameConstants::kContextOffset), 1912 __ cmp(Operand(scratch2, CommonFrameConstants::kContextOrFrameTypeOffset),
1914 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 1913 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1915 __ j(not_equal, &no_arguments_adaptor, Label::kNear); 1914 __ j(not_equal, &no_arguments_adaptor, Label::kNear);
1916 1915
1917 // Drop current frame and load arguments count from arguments adaptor frame. 1916 // Drop current frame and load arguments count from arguments adaptor frame.
1918 __ mov(ebp, scratch2); 1917 __ mov(ebp, scratch2);
1919 __ mov(caller_args_count_reg, 1918 __ mov(caller_args_count_reg,
1920 Operand(ebp, ArgumentsAdaptorFrameConstants::kLengthOffset)); 1919 Operand(ebp, ArgumentsAdaptorFrameConstants::kLengthOffset));
1921 __ SmiUntag(caller_args_count_reg); 1920 __ SmiUntag(caller_args_count_reg);
1922 __ jmp(&formal_parameter_count_loaded, Label::kNear); 1921 __ jmp(&formal_parameter_count_loaded, Label::kNear);
1923 1922
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 __ cmp(eax, ebx); 2449 __ cmp(eax, ebx);
2451 __ j(less, &fill); 2450 __ j(less, &fill);
2452 2451
2453 // Restore expected arguments. 2452 // Restore expected arguments.
2454 __ mov(eax, ecx); 2453 __ mov(eax, ecx);
2455 } 2454 }
2456 2455
2457 // Call the entry point. 2456 // Call the entry point.
2458 __ bind(&invoke); 2457 __ bind(&invoke);
2459 // Restore function pointer. 2458 // Restore function pointer.
2460 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 2459 __ mov(edi, Operand(ebp, ArgumentsAdaptorFrameConstants::kFunctionOffset));
2461 // eax : expected number of arguments 2460 // eax : expected number of arguments
2462 // edx : new target (passed through to callee) 2461 // edx : new target (passed through to callee)
2463 // edi : function (passed through to callee) 2462 // edi : function (passed through to callee)
2464 __ mov(ecx, FieldOperand(edi, JSFunction::kCodeEntryOffset)); 2463 __ mov(ecx, FieldOperand(edi, JSFunction::kCodeEntryOffset));
2465 __ call(ecx); 2464 __ call(ecx);
2466 2465
2467 // Store offset of return address for deoptimizer. 2466 // Store offset of return address for deoptimizer.
2468 masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset()); 2467 masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset());
2469 2468
2470 // Leave frame and return. 2469 // Leave frame and return.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 // And "return" to the OSR entry point of the function. 2629 // And "return" to the OSR entry point of the function.
2631 __ ret(0); 2630 __ ret(0);
2632 } 2631 }
2633 2632
2634 2633
2635 #undef __ 2634 #undef __
2636 } // namespace internal 2635 } // namespace internal
2637 } // namespace v8 2636 } // namespace v8
2638 2637
2639 #endif // V8_TARGET_ARCH_X87 2638 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/ic/x87/handler-compiler-x87.cc ('k') | src/x87/code-stubs-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698