| 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 void FastCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 508 void FastCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
| 509 // Call the runtime to declare the globals. | 509 // Call the runtime to declare the globals. |
| 510 __ push(esi); // The context is the first argument. | 510 __ push(esi); // The context is the first argument. |
| 511 __ push(Immediate(pairs)); | 511 __ push(Immediate(pairs)); |
| 512 __ push(Immediate(Smi::FromInt(is_eval_ ? 1 : 0))); | 512 __ push(Immediate(Smi::FromInt(is_eval_ ? 1 : 0))); |
| 513 __ CallRuntime(Runtime::kDeclareGlobals, 3); | 513 __ CallRuntime(Runtime::kDeclareGlobals, 3); |
| 514 // Return value is ignored. | 514 // Return value is ignored. |
| 515 } | 515 } |
| 516 | 516 |
| 517 | 517 |
| 518 void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { | |
| 519 Comment cmnt(masm_, "[ ReturnStatement"); | |
| 520 Expression* expr = stmt->expression(); | |
| 521 if (expr->AsLiteral() != NULL) { | |
| 522 __ mov(eax, expr->AsLiteral()->handle()); | |
| 523 } else { | |
| 524 ASSERT_EQ(Expression::kValue, expr->context()); | |
| 525 Visit(expr); | |
| 526 __ pop(eax); | |
| 527 } | |
| 528 EmitReturnSequence(stmt->statement_pos()); | |
| 529 } | |
| 530 | |
| 531 | |
| 532 void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { | 518 void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { |
| 533 Comment cmnt(masm_, "[ FunctionLiteral"); | 519 Comment cmnt(masm_, "[ FunctionLiteral"); |
| 534 | 520 |
| 535 // Build the function boilerplate and instantiate it. | 521 // Build the function boilerplate and instantiate it. |
| 536 Handle<JSFunction> boilerplate = | 522 Handle<JSFunction> boilerplate = |
| 537 Compiler::BuildBoilerplate(expr, script_, this); | 523 Compiler::BuildBoilerplate(expr, script_, this); |
| 538 if (HasStackOverflow()) return; | 524 if (HasStackOverflow()) return; |
| 539 | 525 |
| 540 ASSERT(boilerplate->IsBoilerplate()); | 526 ASSERT(boilerplate->IsBoilerplate()); |
| 541 | 527 |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1632 __ bind(&push_false); | 1618 __ bind(&push_false); |
| 1633 __ push(Immediate(Factory::false_value())); | 1619 __ push(Immediate(Factory::false_value())); |
| 1634 __ jmp(saved_false); | 1620 __ jmp(saved_false); |
| 1635 break; | 1621 break; |
| 1636 } | 1622 } |
| 1637 true_label_ = saved_true; | 1623 true_label_ = saved_true; |
| 1638 false_label_ = saved_false; | 1624 false_label_ = saved_false; |
| 1639 // Convert current context to test context: End post-test code. | 1625 // Convert current context to test context: End post-test code. |
| 1640 } | 1626 } |
| 1641 | 1627 |
| 1628 Register FastCodeGenerator::result_register() { return eax; } |
| 1642 | 1629 |
| 1643 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 1630 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
| 1644 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1631 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1645 Move(expr->context(), eax); | 1632 Move(expr->context(), eax); |
| 1646 } | 1633 } |
| 1647 | 1634 |
| 1648 #undef __ | 1635 #undef __ |
| 1649 | 1636 |
| 1650 | 1637 |
| 1651 } } // namespace v8::internal | 1638 } } // namespace v8::internal |
| OLD | NEW |