OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 4403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4414 #ifdef ENABLE_DEBUGGER_SUPPORT | 4414 #ifdef ENABLE_DEBUGGER_SUPPORT |
4415 // Spill everything, even constants, to the frame. | 4415 // Spill everything, even constants, to the frame. |
4416 frame_->SpillAll(); | 4416 frame_->SpillAll(); |
4417 | 4417 |
4418 frame_->DebugBreak(); | 4418 frame_->DebugBreak(); |
4419 // Ignore the return value. | 4419 // Ignore the return value. |
4420 #endif | 4420 #endif |
4421 } | 4421 } |
4422 | 4422 |
4423 | 4423 |
4424 Result CodeGenerator::InstantiateBoilerplate(Handle<JSFunction> boilerplate) { | 4424 Result CodeGenerator::InstantiateFunction( |
4425 ASSERT(boilerplate->IsBoilerplate()); | 4425 Handle<SharedFunctionInfo> function_info) { |
4426 | |
4427 // The inevitable call will sync frame elements to memory anyway, so | 4426 // The inevitable call will sync frame elements to memory anyway, so |
4428 // we do it eagerly to allow us to push the arguments directly into | 4427 // we do it eagerly to allow us to push the arguments directly into |
4429 // place. | 4428 // place. |
4430 frame()->SyncRange(0, frame()->element_count() - 1); | 4429 frame()->SyncRange(0, frame()->element_count() - 1); |
4431 | 4430 |
4432 // Use the fast case closure allocation code that allocates in new | 4431 // Use the fast case closure allocation code that allocates in new |
4433 // space for nested functions that don't need literals cloning. | 4432 // space for nested functions that don't need literals cloning. |
4434 if (scope()->is_function_scope() && boilerplate->NumberOfLiterals() == 0) { | 4433 // TODO(656): reimplement fast new closure stub |
| 4434 if (false && scope()->is_function_scope() && |
| 4435 function_info->num_literals() == 0) { |
4435 FastNewClosureStub stub; | 4436 FastNewClosureStub stub; |
4436 frame()->EmitPush(Immediate(boilerplate)); | 4437 frame()->EmitPush(Immediate(function_info)); |
4437 return frame()->CallStub(&stub, 1); | 4438 return frame()->CallStub(&stub, 1); |
4438 } else { | 4439 } else { |
4439 // Call the runtime to instantiate the function boilerplate | 4440 // Call the runtime to instantiate the function boilerplate |
4440 // object. | 4441 // object. |
4441 frame()->EmitPush(esi); | 4442 frame()->EmitPush(esi); |
4442 frame()->EmitPush(Immediate(boilerplate)); | 4443 frame()->EmitPush(Immediate(function_info)); |
4443 return frame()->CallRuntime(Runtime::kNewClosure, 2); | 4444 return frame()->CallRuntime(Runtime::kNewClosure, 2); |
4444 } | 4445 } |
4445 } | 4446 } |
4446 | 4447 |
4447 | 4448 |
4448 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { | 4449 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { |
4449 Comment cmnt(masm_, "[ FunctionLiteral"); | 4450 Comment cmnt(masm_, "[ FunctionLiteral"); |
4450 ASSERT(!in_safe_int32_mode()); | 4451 ASSERT(!in_safe_int32_mode()); |
4451 // Build the function boilerplate and instantiate it. | 4452 // Build the function info and instantiate it. |
4452 Handle<JSFunction> boilerplate = | 4453 Handle<SharedFunctionInfo> function_info = |
4453 Compiler::BuildBoilerplate(node, script(), this); | 4454 Compiler::BuildFunctionInfo(node, script(), this); |
4454 // Check for stack-overflow exception. | 4455 // Check for stack-overflow exception. |
4455 if (HasStackOverflow()) return; | 4456 if (HasStackOverflow()) return; |
4456 Result result = InstantiateBoilerplate(boilerplate); | 4457 Result result = InstantiateFunction(function_info); |
4457 frame()->Push(&result); | 4458 frame()->Push(&result); |
4458 } | 4459 } |
4459 | 4460 |
4460 | 4461 |
4461 void CodeGenerator::VisitFunctionBoilerplateLiteral( | 4462 void CodeGenerator::VisitSharedFunctionInfoLiteral( |
4462 FunctionBoilerplateLiteral* node) { | 4463 SharedFunctionInfoLiteral* node) { |
4463 ASSERT(!in_safe_int32_mode()); | 4464 ASSERT(!in_safe_int32_mode()); |
4464 Comment cmnt(masm_, "[ FunctionBoilerplateLiteral"); | 4465 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); |
4465 Result result = InstantiateBoilerplate(node->boilerplate()); | 4466 Result result = InstantiateFunction(node->shared_function_info()); |
4466 frame()->Push(&result); | 4467 frame()->Push(&result); |
4467 } | 4468 } |
4468 | 4469 |
4469 | 4470 |
4470 void CodeGenerator::VisitConditional(Conditional* node) { | 4471 void CodeGenerator::VisitConditional(Conditional* node) { |
4471 Comment cmnt(masm_, "[ Conditional"); | 4472 Comment cmnt(masm_, "[ Conditional"); |
4472 ASSERT(!in_safe_int32_mode()); | 4473 ASSERT(!in_safe_int32_mode()); |
4473 JumpTarget then; | 4474 JumpTarget then; |
4474 JumpTarget else_; | 4475 JumpTarget else_; |
4475 JumpTarget exit; | 4476 JumpTarget exit; |
(...skipping 7800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12276 | 12277 |
12277 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 12278 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
12278 // tagged as a small integer. | 12279 // tagged as a small integer. |
12279 __ bind(&runtime); | 12280 __ bind(&runtime); |
12280 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 12281 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
12281 } | 12282 } |
12282 | 12283 |
12283 #undef __ | 12284 #undef __ |
12284 | 12285 |
12285 } } // namespace v8::internal | 12286 } } // namespace v8::internal |
OLD | NEW |