OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 | 1424 |
1425 // If we have a function or a constant, we need to initialize the variable. | 1425 // If we have a function or a constant, we need to initialize the variable. |
1426 Expression* val = NULL; | 1426 Expression* val = NULL; |
1427 if (node->mode() == Variable::CONST) { | 1427 if (node->mode() == Variable::CONST) { |
1428 val = new Literal(Factory::the_hole_value()); | 1428 val = new Literal(Factory::the_hole_value()); |
1429 } else { | 1429 } else { |
1430 val = node->fun(); // NULL if we don't have a function | 1430 val = node->fun(); // NULL if we don't have a function |
1431 } | 1431 } |
1432 | 1432 |
1433 if (val != NULL) { | 1433 if (val != NULL) { |
1434 // Set initial value. | 1434 { |
1435 Reference target(this, node->proxy()); | 1435 // Set initial value. |
1436 ASSERT(target.is_slot()); | 1436 Reference target(this, node->proxy()); |
1437 Load(val); | 1437 Load(val); |
1438 target.SetValue(NOT_CONST_INIT); | 1438 target.SetValue(NOT_CONST_INIT); |
1439 // Get rid of the assigned value (declarations are statements). It's | 1439 } |
1440 // safe to pop the value lying on top of the reference before unloading | 1440 // Get rid of the assigned value (declarations are statements). |
1441 // the reference itself (which preserves the top of stack) because we | |
1442 // know that it is a zero-sized reference. | |
1443 frame_->Pop(); | 1441 frame_->Pop(); |
1444 } | 1442 } |
1445 } | 1443 } |
1446 | 1444 |
1447 | 1445 |
1448 void CodeGenerator::VisitExpressionStatement(ExpressionStatement* node) { | 1446 void CodeGenerator::VisitExpressionStatement(ExpressionStatement* node) { |
1449 Comment cmnt(masm_, "[ ExpressionStatement"); | 1447 Comment cmnt(masm_, "[ ExpressionStatement"); |
1450 CodeForStatement(node); | 1448 CodeForStatement(node); |
1451 Expression* expression = node->expression(); | 1449 Expression* expression = node->expression(); |
1452 expression->MarkAsStatement(); | 1450 expression->MarkAsStatement(); |
(...skipping 3857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5310 | 5308 |
5311 // Slow-case: Go through the JavaScript implementation. | 5309 // Slow-case: Go through the JavaScript implementation. |
5312 __ bind(&slow); | 5310 __ bind(&slow); |
5313 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 5311 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
5314 } | 5312 } |
5315 | 5313 |
5316 | 5314 |
5317 #undef __ | 5315 #undef __ |
5318 | 5316 |
5319 } } // namespace v8::internal | 5317 } } // namespace v8::internal |
OLD | NEW |