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

Side by Side Diff: src/compiler/linkage-impl.h

Issue 892593002: [turbofan] Fix usage of ThisFunction parameter in OSR. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/compiler/linkage.cc ('k') | src/compiler/mips/linkage-mips.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #ifndef V8_COMPILER_LINKAGE_IMPL_H_ 5 #ifndef V8_COMPILER_LINKAGE_IMPL_H_
6 #define V8_COMPILER_LINKAGE_IMPL_H_ 6 #define V8_COMPILER_LINKAGE_IMPL_H_
7 7
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler/osr.h" 9 #include "src/compiler/osr.h"
10 10
(...skipping 11 matching lines...) Expand all
22 DCHECK(locations->return_count_ <= 2); 22 DCHECK(locations->return_count_ <= 2);
23 if (locations->return_count_ > 0) { 23 if (locations->return_count_ > 0) {
24 locations->AddReturn(regloc(LinkageTraits::ReturnValueReg())); 24 locations->AddReturn(regloc(LinkageTraits::ReturnValueReg()));
25 } 25 }
26 if (locations->return_count_ > 1) { 26 if (locations->return_count_ > 1) {
27 locations->AddReturn(regloc(LinkageTraits::ReturnValue2Reg())); 27 locations->AddReturn(regloc(LinkageTraits::ReturnValue2Reg()));
28 } 28 }
29 } 29 }
30 30
31 // TODO(turbofan): cache call descriptors for JSFunction calls. 31 // TODO(turbofan): cache call descriptors for JSFunction calls.
32 static CallDescriptor* GetJSCallDescriptor(Zone* zone, int js_parameter_count, 32 static CallDescriptor* GetJSCallDescriptor(Zone* zone, bool is_osr,
33 int js_parameter_count,
33 CallDescriptor::Flags flags) { 34 CallDescriptor::Flags flags) {
34 const size_t return_count = 1; 35 const size_t return_count = 1;
35 const size_t context_count = 1; 36 const size_t context_count = 1;
36 const size_t parameter_count = js_parameter_count + context_count; 37 const size_t parameter_count = js_parameter_count + context_count;
37 38
38 LocationSignature::Builder locations(zone, return_count, parameter_count); 39 LocationSignature::Builder locations(zone, return_count, parameter_count);
39 MachineSignature::Builder types(zone, return_count, parameter_count); 40 MachineSignature::Builder types(zone, return_count, parameter_count);
40 41
41 // Add returns. 42 // Add returns.
42 AddReturnLocations(&locations); 43 AddReturnLocations(&locations);
43 for (size_t i = 0; i < return_count; i++) { 44 for (size_t i = 0; i < return_count; i++) {
44 types.AddReturn(kMachAnyTagged); 45 types.AddReturn(kMachAnyTagged);
45 } 46 }
46 47
47 // All parameters to JS calls go on the stack. 48 // All parameters to JS calls go on the stack.
48 for (int i = 0; i < js_parameter_count; i++) { 49 for (int i = 0; i < js_parameter_count; i++) {
49 int spill_slot_index = i - js_parameter_count; 50 int spill_slot_index = i - js_parameter_count;
50 locations.AddParam(stackloc(spill_slot_index)); 51 locations.AddParam(stackloc(spill_slot_index));
51 types.AddParam(kMachAnyTagged); 52 types.AddParam(kMachAnyTagged);
52 } 53 }
53 // Add context. 54 // Add context.
54 locations.AddParam(regloc(LinkageTraits::ContextReg())); 55 locations.AddParam(regloc(LinkageTraits::ContextReg()));
55 types.AddParam(kMachAnyTagged); 56 types.AddParam(kMachAnyTagged);
56 57
57 // The target for JS function calls is the JSFunction object. 58 // The target for JS function calls is the JSFunction object.
58 MachineType target_type = kMachAnyTagged; 59 MachineType target_type = kMachAnyTagged;
59 LinkageLocation target_loc = regloc(LinkageTraits::JSCallFunctionReg()); 60 // Unoptimized code doesn't preserve the JSCallFunctionReg, so expect the
61 // closure on the stack.
62 LinkageLocation target_loc =
63 is_osr ? stackloc(Linkage::kJSFunctionCallClosureParamIndex -
64 js_parameter_count)
65 : regloc(LinkageTraits::JSCallFunctionReg());
60 return new (zone) CallDescriptor( // -- 66 return new (zone) CallDescriptor( // --
61 CallDescriptor::kCallJSFunction, // kind 67 CallDescriptor::kCallJSFunction, // kind
62 target_type, // target MachineType 68 target_type, // target MachineType
63 target_loc, // target location 69 target_loc, // target location
64 types.Build(), // machine_sig 70 types.Build(), // machine_sig
65 locations.Build(), // location_sig 71 locations.Build(), // location_sig
66 js_parameter_count, // js_parameter_count 72 js_parameter_count, // js_parameter_count
67 Operator::kNoProperties, // properties 73 Operator::kNoProperties, // properties
68 kNoCalleeSaved, // callee-saved 74 kNoCalleeSaved, // callee-saved
69 flags, // flags 75 flags, // flags
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 return incoming_->GetInputLocation(parameter_index); 253 return incoming_->GetInputLocation(parameter_index);
248 } 254 }
249 } 255 }
250 256
251 257
252 } // namespace compiler 258 } // namespace compiler
253 } // namespace internal 259 } // namespace internal
254 } // namespace v8 260 } // namespace v8
255 261
256 #endif // V8_COMPILER_LINKAGE_IMPL_H_ 262 #endif // V8_COMPILER_LINKAGE_IMPL_H_
OLDNEW
« no previous file with comments | « src/compiler/linkage.cc ('k') | src/compiler/mips/linkage-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698