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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 | 1137 |
1138 // If we have a function or a constant, we need to initialize the variable. | 1138 // If we have a function or a constant, we need to initialize the variable. |
1139 Expression* val = NULL; | 1139 Expression* val = NULL; |
1140 if (node->mode() == Variable::CONST) { | 1140 if (node->mode() == Variable::CONST) { |
1141 val = new Literal(Factory::the_hole_value()); | 1141 val = new Literal(Factory::the_hole_value()); |
1142 } else { | 1142 } else { |
1143 val = node->fun(); // NULL if we don't have a function | 1143 val = node->fun(); // NULL if we don't have a function |
1144 } | 1144 } |
1145 | 1145 |
1146 if (val != NULL) { | 1146 if (val != NULL) { |
1147 // Set initial value. | 1147 { |
1148 Reference target(this, node->proxy()); | 1148 // Set initial value. |
1149 ASSERT(target.is_slot()); | 1149 Reference target(this, node->proxy()); |
1150 Load(val); | 1150 Load(val); |
1151 target.SetValue(NOT_CONST_INIT); | 1151 target.SetValue(NOT_CONST_INIT); |
1152 // Get rid of the assigned value (declarations are statements). It's | 1152 } |
1153 // safe to pop the value lying on top of the reference before unloading | 1153 // Get rid of the assigned value (declarations are statements). |
1154 // the reference itself (which preserves the top of stack) because we | |
1155 // know it is a zero-sized reference. | |
1156 frame_->Pop(); | 1154 frame_->Pop(); |
1157 } | 1155 } |
1158 } | 1156 } |
1159 | 1157 |
1160 | 1158 |
1161 void CodeGenerator::VisitExpressionStatement(ExpressionStatement* node) { | 1159 void CodeGenerator::VisitExpressionStatement(ExpressionStatement* node) { |
1162 Comment cmnt(masm_, "[ ExpressionStatement"); | 1160 Comment cmnt(masm_, "[ ExpressionStatement"); |
1163 CodeForStatement(node); | 1161 CodeForStatement(node); |
1164 Expression* expression = node->expression(); | 1162 Expression* expression = node->expression(); |
1165 expression->MarkAsStatement(); | 1163 expression->MarkAsStatement(); |
(...skipping 3195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4361 __ mov(r2, Operand(0)); | 4359 __ mov(r2, Operand(0)); |
4362 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 4360 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
4363 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), | 4361 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), |
4364 RelocInfo::CODE_TARGET); | 4362 RelocInfo::CODE_TARGET); |
4365 } | 4363 } |
4366 | 4364 |
4367 | 4365 |
4368 #undef __ | 4366 #undef __ |
4369 | 4367 |
4370 } } // namespace v8::internal | 4368 } } // namespace v8::internal |
OLD | NEW |