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

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: Fix merge problems 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 : regloc(kJSFunctionRegister);
328 return new (zone) CallDescriptor( // -- 329 return new (zone) CallDescriptor( // --
329 CallDescriptor::kCallJSFunction, // kind 330 CallDescriptor::kCallJSFunction, // kind
330 target_type, // target MachineType 331 target_type, // target MachineType
331 target_loc, // target location 332 target_loc, // target location
332 types.Build(), // machine_sig 333 types.Build(), // machine_sig
333 locations.Build(), // location_sig 334 locations.Build(), // location_sig
334 js_parameter_count, // stack_parameter_count 335 js_parameter_count, // stack_parameter_count
335 Operator::kNoProperties, // properties 336 Operator::kNoProperties, // properties
336 kNoCalleeSaved, // callee-saved 337 kNoCalleeSaved, // callee-saved
337 kNoCalleeSaved, // callee-saved fp 338 kNoCalleeSaved, // callee-saved fp
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 return LinkageLocation::ForCalleeFrameSlot(spill_index); 430 return LinkageLocation::ForCalleeFrameSlot(spill_index);
430 } else { 431 } else {
431 // Parameter. Use the assigned location from the incoming call descriptor. 432 // Parameter. Use the assigned location from the incoming call descriptor.
432 int parameter_index = 1 + index; // skip index 0, which is the target. 433 int parameter_index = 1 + index; // skip index 0, which is the target.
433 return incoming_->GetInputLocation(parameter_index); 434 return incoming_->GetInputLocation(parameter_index);
434 } 435 }
435 } 436 }
436 437
437 438
438 bool Linkage::ParameterHasSecondaryLocation(int index) const { 439 bool Linkage::ParameterHasSecondaryLocation(int index) const {
439 if (incoming_->kind() != CallDescriptor::kCallJSFunction) return false; 440 if (!incoming_->IsJSFunctionCall()) return false;
440 LinkageLocation loc = GetParameterLocation(index); 441 LinkageLocation loc = GetParameterLocation(index);
441 return (loc == regloc(kJSFunctionRegister) || 442 return (loc == regloc(kJSFunctionRegister) ||
442 loc == regloc(kContextRegister)); 443 loc == regloc(kContextRegister));
443 } 444 }
444 445
445 LinkageLocation Linkage::GetParameterSecondaryLocation(int index) const { 446 LinkageLocation Linkage::GetParameterSecondaryLocation(int index) const {
446 DCHECK(ParameterHasSecondaryLocation(index)); 447 DCHECK(ParameterHasSecondaryLocation(index));
447 LinkageLocation loc = GetParameterLocation(index); 448 LinkageLocation loc = GetParameterLocation(index);
448 449
449 if (loc == regloc(kJSFunctionRegister)) { 450 if (loc == regloc(kJSFunctionRegister)) {
450 return LinkageLocation::ForCalleeFrameSlot(Frame::kJSFunctionSlot); 451 return LinkageLocation::ForCalleeFrameSlot(Frame::kJSFunctionSlot);
451 } else { 452 } else {
452 DCHECK(loc == regloc(kContextRegister)); 453 DCHECK(loc == regloc(kContextRegister));
453 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); 454 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot);
454 } 455 }
455 } 456 }
456 457
457 458
458 } // namespace compiler 459 } // namespace compiler
459 } // namespace internal 460 } // namespace internal
460 } // namespace v8 461 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698