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

Side by Side Diff: src/full-codegen/full-codegen.cc

Issue 1412153002: [fullcode] Make intrinsic-to-stub-call handling platform independent. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment tweaks Created 5 years, 2 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/full-codegen/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.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 #include "src/full-codegen/full-codegen.h" 5 #include "src/full-codegen/full-codegen.h"
6 6
7 #include "src/ast.h" 7 #include "src/ast.h"
8 #include "src/ast-numbering.h" 8 #include "src/ast-numbering.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 DCHECK(args->length() == 2); 475 DCHECK(args->length() == 2);
476 VisitForStackValue(args->at(0)); 476 VisitForStackValue(args->at(0));
477 VisitForStackValue(args->at(1)); 477 VisitForStackValue(args->at(1));
478 478
479 MathPowStub stub(isolate(), MathPowStub::ON_STACK); 479 MathPowStub stub(isolate(), MathPowStub::ON_STACK);
480 __ CallStub(&stub); 480 __ CallStub(&stub);
481 context()->Plug(result_register()); 481 context()->Plug(result_register());
482 } 482 }
483 483
484 484
485 void FullCodeGenerator::EmitIntrinsicAsStubCall(CallRuntime* expr,
486 const Callable& callable) {
487 ZoneList<Expression*>* args = expr->arguments();
488 int param_count = callable.descriptor().GetRegisterParameterCount();
489 DCHECK_EQ(args->length(), param_count);
490
491 if (param_count > 0) {
492 int last = param_count - 1;
493 // Put all but last arguments on stack.
494 for (int i = 0; i < last; i++) {
495 VisitForStackValue(args->at(i));
496 }
497 // The last argument goes to the accumulator.
498 VisitForAccumulatorValue(args->at(last));
499
500 // Move the arguments to the registers, as required by the stub.
501 __ Move(callable.descriptor().GetRegisterParameter(last),
502 result_register());
503 for (int i = last; i-- > 0;) {
504 __ Pop(callable.descriptor().GetRegisterParameter(i));
505 }
506 }
507 __ Call(callable.code(), RelocInfo::CODE_TARGET);
508 context()->Plug(result_register());
509 }
510
511
512 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) {
513 EmitIntrinsicAsStubCall(expr, CodeFactory::NumberToString(isolate()));
514 }
515
516
517 void FullCodeGenerator::EmitToString(CallRuntime* expr) {
518 EmitIntrinsicAsStubCall(expr, CodeFactory::ToString(isolate()));
519 }
520
521
522 void FullCodeGenerator::EmitToLength(CallRuntime* expr) {
523 EmitIntrinsicAsStubCall(expr, CodeFactory::ToLength(isolate()));
524 }
525
526
527 void FullCodeGenerator::EmitToNumber(CallRuntime* expr) {
528 EmitIntrinsicAsStubCall(expr, CodeFactory::ToNumber(isolate()));
529 }
530
531
532 void FullCodeGenerator::EmitToObject(CallRuntime* expr) {
533 EmitIntrinsicAsStubCall(expr, CodeFactory::ToObject(isolate()));
534 }
535
536
537 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) {
538 EmitIntrinsicAsStubCall(expr, CodeFactory::RegExpConstructResult(isolate()));
539 }
540
541
485 bool RecordStatementPosition(MacroAssembler* masm, int pos) { 542 bool RecordStatementPosition(MacroAssembler* masm, int pos) {
486 if (pos == RelocInfo::kNoPosition) return false; 543 if (pos == RelocInfo::kNoPosition) return false;
487 masm->positions_recorder()->RecordStatementPosition(pos); 544 masm->positions_recorder()->RecordStatementPosition(pos);
488 masm->positions_recorder()->RecordPosition(pos); 545 masm->positions_recorder()->RecordPosition(pos);
489 return masm->positions_recorder()->WriteRecordedPositions(); 546 return masm->positions_recorder()->WriteRecordedPositions();
490 } 547 }
491 548
492 549
493 bool RecordPosition(MacroAssembler* masm, int pos) { 550 bool RecordPosition(MacroAssembler* masm, int pos) {
494 if (pos == RelocInfo::kNoPosition) return false; 551 if (pos == RelocInfo::kNoPosition) return false;
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || 1665 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() ||
1609 var->initializer_position() >= proxy->position(); 1666 var->initializer_position() >= proxy->position();
1610 } 1667 }
1611 1668
1612 1669
1613 #undef __ 1670 #undef __
1614 1671
1615 1672
1616 } // namespace internal 1673 } // namespace internal
1617 } // namespace v8 1674 } // namespace v8
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698