| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // Add a label for checking the size of the code used for returning. | 300 // Add a label for checking the size of the code used for returning. |
| 301 Label check_exit_codesize; | 301 Label check_exit_codesize; |
| 302 masm_->bind(&check_exit_codesize); | 302 masm_->bind(&check_exit_codesize); |
| 303 #endif | 303 #endif |
| 304 SetSourcePosition(function()->end_position() - 1); | 304 SetSourcePosition(function()->end_position() - 1); |
| 305 __ RecordJSReturn(); | 305 __ RecordJSReturn(); |
| 306 // Do not use the leave instruction here because it is too short to | 306 // Do not use the leave instruction here because it is too short to |
| 307 // patch with the code required by the debugger. | 307 // patch with the code required by the debugger. |
| 308 __ mov(esp, ebp); | 308 __ mov(esp, ebp); |
| 309 __ pop(ebp); | 309 __ pop(ebp); |
| 310 __ ret((scope()->num_parameters() + 1) * kPointerSize); | 310 |
| 311 int arguments_bytes = (scope()->num_parameters() + 1) * kPointerSize; |
| 312 __ Ret(arguments_bytes, ecx); |
| 311 #ifdef ENABLE_DEBUGGER_SUPPORT | 313 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 312 // Check that the size of the code used for returning matches what is | 314 // Check that the size of the code used for returning is large enough |
| 313 // expected by the debugger. | 315 // for the debugger's requirements. |
| 314 ASSERT_EQ(Assembler::kJSReturnSequenceLength, | 316 ASSERT(Assembler::kJSReturnSequenceLength <= |
| 315 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); | 317 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); |
| 316 #endif | 318 #endif |
| 317 } | 319 } |
| 318 } | 320 } |
| 319 | 321 |
| 320 | 322 |
| 321 FullCodeGenerator::ConstantOperand FullCodeGenerator::GetConstantOperand( | 323 FullCodeGenerator::ConstantOperand FullCodeGenerator::GetConstantOperand( |
| 322 Token::Value op, Expression* left, Expression* right) { | 324 Token::Value op, Expression* left, Expression* right) { |
| 323 ASSERT(ShouldInlineSmiCase(op)); | 325 ASSERT(ShouldInlineSmiCase(op)); |
| 324 if (op == Token::DIV || op == Token::MOD || op == Token::MUL) { | 326 if (op == Token::DIV || op == Token::MOD || op == Token::MUL) { |
| 325 // We never generate inlined constant smi operations for these. | 327 // We never generate inlined constant smi operations for these. |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 __ push(Immediate(Smi::FromInt(0))); // No initial value! | 708 __ push(Immediate(Smi::FromInt(0))); // No initial value! |
| 707 } | 709 } |
| 708 __ CallRuntime(Runtime::kDeclareContextSlot, 4); | 710 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
| 709 break; | 711 break; |
| 710 } | 712 } |
| 711 } | 713 } |
| 712 | 714 |
| 713 } else if (prop != NULL) { | 715 } else if (prop != NULL) { |
| 714 if (function != NULL || mode == Variable::CONST) { | 716 if (function != NULL || mode == Variable::CONST) { |
| 715 // We are declaring a function or constant that rewrites to a | 717 // We are declaring a function or constant that rewrites to a |
| 716 // property. Use (keyed) IC to set the initial value. | 718 // property. Use (keyed) IC to set the initial value. We cannot |
| 717 VisitForStackValue(prop->obj()); | 719 // visit the rewrite because it's shared and we risk recording |
| 720 // duplicate AST IDs for bailouts from optimized code. |
| 721 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
| 722 { AccumulatorValueContext for_object(this); |
| 723 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); |
| 724 } |
| 725 |
| 718 if (function != NULL) { | 726 if (function != NULL) { |
| 719 VisitForStackValue(prop->key()); | 727 __ push(eax); |
| 720 VisitForAccumulatorValue(function); | 728 VisitForAccumulatorValue(function); |
| 721 __ pop(ecx); | 729 __ pop(edx); |
| 722 } else { | 730 } else { |
| 723 VisitForAccumulatorValue(prop->key()); | 731 __ mov(edx, eax); |
| 724 __ mov(ecx, result_register()); | 732 __ mov(eax, Factory::the_hole_value()); |
| 725 __ mov(result_register(), Factory::the_hole_value()); | |
| 726 } | 733 } |
| 727 __ pop(edx); | 734 ASSERT(prop->key()->AsLiteral() != NULL && |
| 735 prop->key()->AsLiteral()->handle()->IsSmi()); |
| 736 __ Set(ecx, Immediate(prop->key()->AsLiteral()->handle())); |
| 728 | 737 |
| 729 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 738 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); |
| 730 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 739 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 731 } | 740 } |
| 732 } | 741 } |
| 733 } | 742 } |
| 734 | 743 |
| 735 | 744 |
| 736 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 745 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
| 737 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); | 746 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); |
| (...skipping 3628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4366 // And return. | 4375 // And return. |
| 4367 __ ret(0); | 4376 __ ret(0); |
| 4368 } | 4377 } |
| 4369 | 4378 |
| 4370 | 4379 |
| 4371 #undef __ | 4380 #undef __ |
| 4372 | 4381 |
| 4373 } } // namespace v8::internal | 4382 } } // namespace v8::internal |
| 4374 | 4383 |
| 4375 #endif // V8_TARGET_ARCH_IA32 | 4384 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |