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

Side by Side Diff: src/compiler/linkage.cc

Issue 1696043002: [runtime] Unify and simplify how frames are marked (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: All platforms 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
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 #include "src/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/common-operator.h" 8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/frame.h" 9 #include "src/compiler/frame.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 types.AddParam(MachineType::Int32()); 316 types.AddParam(MachineType::Int32());
317 317
318 // Add context. 318 // Add context.
319 locations.AddParam(regloc(kContextRegister)); 319 locations.AddParam(regloc(kContextRegister));
320 types.AddParam(MachineType::AnyTagged()); 320 types.AddParam(MachineType::AnyTagged());
321 321
322 // The target for JS function calls is the JSFunction object. 322 // The target for JS function calls is the JSFunction object.
323 MachineType target_type = MachineType::AnyTagged(); 323 MachineType target_type = MachineType::AnyTagged();
324 // When entering into an OSR function from unoptimized code the JSFunction 324 // When entering into an OSR function from unoptimized code the JSFunction
325 // is not in a register, but it is on the stack in the marker spill slot. 325 // is not in a register, but it is on the stack in the marker spill slot.
326 LinkageLocation target_loc = is_osr ? LinkageLocation::ForSavedCallerMarker() 326 LinkageLocation target_loc = is_osr
327 : regloc(kJSFunctionRegister); 327 ? LinkageLocation::ForSavedCallerFunction()
328 return new (zone) CallDescriptor( // -- 328 : regloc(kJSFunctionRegister);
329 CallDescriptor::kCallJSFunction, // kind 329 return new (zone) CallDescriptor( // --
330 target_type, // target MachineType 330 CallDescriptor::kCallJSFunction, // kind
331 target_loc, // target location 331 target_type, // target MachineType
332 types.Build(), // machine_sig 332 target_loc, // target location
333 locations.Build(), // location_sig 333 types.Build(), // machine_sig
334 js_parameter_count, // stack_parameter_count 334 locations.Build(), // location_sig
335 Operator::kNoProperties, // properties 335 js_parameter_count, // stack_parameter_count
336 kNoCalleeSaved, // callee-saved 336 Operator::kNoProperties, // properties
337 kNoCalleeSaved, // callee-saved fp 337 kNoCalleeSaved, // callee-saved
338 CallDescriptor::kCanUseRoots | // flags 338 kNoCalleeSaved, // callee-saved fp
339 flags, // flags 339 CallDescriptor::kCanUseRoots | // flags
340 CallDescriptor::kHasStandardFrameHeader | // flags
341 flags, // flags
340 "js-call"); 342 "js-call");
341 } 343 }
342 344
343 // TODO(all): Add support for return representations/locations to 345 // TODO(all): Add support for return representations/locations to
344 // CallInterfaceDescriptor. 346 // CallInterfaceDescriptor.
345 // TODO(turbofan): cache call descriptors for code stub calls. 347 // TODO(turbofan): cache call descriptors for code stub calls.
346 CallDescriptor* Linkage::GetStubCallDescriptor( 348 CallDescriptor* Linkage::GetStubCallDescriptor(
347 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, 349 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
348 int stack_parameter_count, CallDescriptor::Flags flags, 350 int stack_parameter_count, CallDescriptor::Flags flags,
349 Operator::Properties properties, MachineType return_type, 351 Operator::Properties properties, MachineType return_type,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 return LinkageLocation::ForCalleeFrameSlot(spill_index); 431 return LinkageLocation::ForCalleeFrameSlot(spill_index);
430 } else { 432 } else {
431 // Parameter. Use the assigned location from the incoming call descriptor. 433 // Parameter. Use the assigned location from the incoming call descriptor.
432 int parameter_index = 1 + index; // skip index 0, which is the target. 434 int parameter_index = 1 + index; // skip index 0, which is the target.
433 return incoming_->GetInputLocation(parameter_index); 435 return incoming_->GetInputLocation(parameter_index);
434 } 436 }
435 } 437 }
436 438
437 439
438 bool Linkage::ParameterHasSecondaryLocation(int index) const { 440 bool Linkage::ParameterHasSecondaryLocation(int index) const {
441 if (incoming_->flags() & CallDescriptor::kHasStandardFrameHeader) {
442 return false;
443 }
439 if (incoming_->kind() != CallDescriptor::kCallJSFunction) return false; 444 if (incoming_->kind() != CallDescriptor::kCallJSFunction) return false;
440 LinkageLocation loc = GetParameterLocation(index); 445 LinkageLocation loc = GetParameterLocation(index);
441 return (loc == regloc(kJSFunctionRegister) || 446 return (loc == regloc(kJSFunctionRegister) ||
442 loc == regloc(kContextRegister)); 447 loc == regloc(kContextRegister));
443 } 448 }
444 449
445 LinkageLocation Linkage::GetParameterSecondaryLocation(int index) const { 450 LinkageLocation Linkage::GetParameterSecondaryLocation(int index) const {
446 DCHECK(ParameterHasSecondaryLocation(index)); 451 DCHECK(ParameterHasSecondaryLocation(index));
447 LinkageLocation loc = GetParameterLocation(index); 452 LinkageLocation loc = GetParameterLocation(index);
448 453
449 if (loc == regloc(kJSFunctionRegister)) { 454 if (loc == regloc(kJSFunctionRegister)) {
450 return LinkageLocation::ForCalleeFrameSlot(Frame::kJSFunctionSlot); 455 return LinkageLocation::ForCalleeFrameSlot(Frame::kJSFunctionSlot);
451 } else { 456 } else {
452 DCHECK(loc == regloc(kContextRegister)); 457 DCHECK(loc == regloc(kContextRegister));
453 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); 458 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot);
454 } 459 }
455 } 460 }
456 461
457 462
458 } // namespace compiler 463 } // namespace compiler
459 } // namespace internal 464 } // namespace internal
460 } // namespace v8 465 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698