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 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 // Note: For variables we must not push an initial value (such as | 1728 // Note: For variables we must not push an initial value (such as |
1729 // 'undefined') because we may have a (legal) redeclaration and we | 1729 // 'undefined') because we may have a (legal) redeclaration and we |
1730 // must not destroy the current value. | 1730 // must not destroy the current value. |
1731 if (node->mode() == Variable::CONST) { | 1731 if (node->mode() == Variable::CONST) { |
1732 __ push(Immediate(Factory::the_hole_value())); | 1732 __ push(Immediate(Factory::the_hole_value())); |
1733 } else if (node->fun() != NULL) { | 1733 } else if (node->fun() != NULL) { |
1734 Load(node->fun()); | 1734 Load(node->fun()); |
1735 } else { | 1735 } else { |
1736 __ push(Immediate(0)); // no initial value! | 1736 __ push(Immediate(0)); // no initial value! |
1737 } | 1737 } |
1738 __ CallRuntime(Runtime::kDeclareContextSlot, 5); | 1738 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
1739 // DeclareContextSlot pops the assigned value by accepting an | 1739 // Ignore the return value (declarations are statements). |
1740 // extra argument and returning the TOS; no need to explicitly | |
1741 // pop here. | |
1742 __ push(eax); | |
1743 return; | 1740 return; |
1744 } | 1741 } |
1745 | 1742 |
1746 ASSERT(!var->is_global()); | 1743 ASSERT(!var->is_global()); |
1747 | 1744 |
1748 // If we have a function or a constant, we need to initialize the variable. | 1745 // If we have a function or a constant, we need to initialize the variable. |
1749 Expression* val = NULL; | 1746 Expression* val = NULL; |
1750 if (node->mode() == Variable::CONST) { | 1747 if (node->mode() == Variable::CONST) { |
1751 val = new Literal(Factory::the_hole_value()); | 1748 val = new Literal(Factory::the_hole_value()); |
1752 } else { | 1749 } else { |
(...skipping 3596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5349 bool is_eval) { | 5346 bool is_eval) { |
5350 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval); | 5347 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval); |
5351 if (!code.is_null()) { | 5348 if (!code.is_null()) { |
5352 Counters::total_compiled_code_size.Increment(code->instruction_size()); | 5349 Counters::total_compiled_code_size.Increment(code->instruction_size()); |
5353 } | 5350 } |
5354 return code; | 5351 return code; |
5355 } | 5352 } |
5356 | 5353 |
5357 | 5354 |
5358 } } // namespace v8::internal | 5355 } } // namespace v8::internal |
OLD | NEW |