| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 void FastCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 518 void FastCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
| 519 // Call the runtime to declare the globals. | 519 // Call the runtime to declare the globals. |
| 520 __ push(rsi); // The context is the first argument. | 520 __ push(rsi); // The context is the first argument. |
| 521 __ Push(pairs); | 521 __ Push(pairs); |
| 522 __ Push(Smi::FromInt(is_eval_ ? 1 : 0)); | 522 __ Push(Smi::FromInt(is_eval_ ? 1 : 0)); |
| 523 __ CallRuntime(Runtime::kDeclareGlobals, 3); | 523 __ CallRuntime(Runtime::kDeclareGlobals, 3); |
| 524 // Return value is ignored. | 524 // Return value is ignored. |
| 525 } | 525 } |
| 526 | 526 |
| 527 | 527 |
| 528 void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { | |
| 529 Comment cmnt(masm_, "[ ReturnStatement"); | |
| 530 Expression* expr = stmt->expression(); | |
| 531 if (expr->AsLiteral() != NULL) { | |
| 532 __ Move(rax, expr->AsLiteral()->handle()); | |
| 533 } else { | |
| 534 Visit(expr); | |
| 535 ASSERT_EQ(Expression::kValue, expr->context()); | |
| 536 __ pop(rax); | |
| 537 } | |
| 538 EmitReturnSequence(stmt->statement_pos()); | |
| 539 } | |
| 540 | |
| 541 | |
| 542 void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { | 528 void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { |
| 543 Comment cmnt(masm_, "[ FunctionLiteral"); | 529 Comment cmnt(masm_, "[ FunctionLiteral"); |
| 544 | 530 |
| 545 // Build the function boilerplate and instantiate it. | 531 // Build the function boilerplate and instantiate it. |
| 546 Handle<JSFunction> boilerplate = | 532 Handle<JSFunction> boilerplate = |
| 547 Compiler::BuildBoilerplate(expr, script_, this); | 533 Compiler::BuildBoilerplate(expr, script_, this); |
| 548 if (HasStackOverflow()) return; | 534 if (HasStackOverflow()) return; |
| 549 | 535 |
| 550 ASSERT(boilerplate->IsBoilerplate()); | 536 ASSERT(boilerplate->IsBoilerplate()); |
| 551 | 537 |
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 // Convert current context to test context: End post-test code. | 1629 // Convert current context to test context: End post-test code. |
| 1644 } | 1630 } |
| 1645 | 1631 |
| 1646 | 1632 |
| 1647 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 1633 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
| 1648 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1634 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1649 Move(expr->context(), rax); | 1635 Move(expr->context(), rax); |
| 1650 } | 1636 } |
| 1651 | 1637 |
| 1652 | 1638 |
| 1639 Register FastCodeGenerator::result_register() { return rax; } |
| 1640 |
| 1653 #undef __ | 1641 #undef __ |
| 1654 | 1642 |
| 1655 | 1643 |
| 1656 } } // namespace v8::internal | 1644 } } // namespace v8::internal |
| OLD | NEW |