| 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 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2298 Comment cmnt(masm_, "[ DebuggerStatament"); | 2298 Comment cmnt(masm_, "[ DebuggerStatament"); |
| 2299 CodeForStatementPosition(node); | 2299 CodeForStatementPosition(node); |
| 2300 #ifdef ENABLE_DEBUGGER_SUPPORT | 2300 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 2301 frame_->DebugBreak(); | 2301 frame_->DebugBreak(); |
| 2302 #endif | 2302 #endif |
| 2303 // Ignore the return value. | 2303 // Ignore the return value. |
| 2304 ASSERT(frame_->height() == original_height); | 2304 ASSERT(frame_->height() == original_height); |
| 2305 } | 2305 } |
| 2306 | 2306 |
| 2307 | 2307 |
| 2308 void CodeGenerator::InstantiateBoilerplate(Handle<JSFunction> boilerplate) { | 2308 void CodeGenerator::InstantiateFunction( |
| 2309 Handle<SharedFunctionInfo> function_info) { |
| 2309 VirtualFrame::SpilledScope spilled_scope; | 2310 VirtualFrame::SpilledScope spilled_scope; |
| 2310 ASSERT(boilerplate->IsBoilerplate()); | 2311 __ mov(r0, Operand(function_info)); |
| 2311 | |
| 2312 __ mov(r0, Operand(boilerplate)); | |
| 2313 // Use the fast case closure allocation code that allocates in new | 2312 // Use the fast case closure allocation code that allocates in new |
| 2314 // space for nested functions that don't need literals cloning. | 2313 // space for nested functions that don't need literals cloning. |
| 2315 if (scope()->is_function_scope() && boilerplate->NumberOfLiterals() == 0) { | 2314 if (false && |
| 2315 scope()->is_function_scope() && function_info->num_literals() == 0) { |
| 2316 FastNewClosureStub stub; | 2316 FastNewClosureStub stub; |
| 2317 frame_->EmitPush(r0); | 2317 frame_->EmitPush(r0); |
| 2318 frame_->CallStub(&stub, 1); | 2318 frame_->CallStub(&stub, 1); |
| 2319 frame_->EmitPush(r0); | 2319 frame_->EmitPush(r0); |
| 2320 } else { | 2320 } else { |
| 2321 // Create a new closure. | 2321 // Create a new closure. |
| 2322 frame_->EmitPush(cp); | 2322 frame_->EmitPush(cp); |
| 2323 frame_->EmitPush(r0); | 2323 frame_->EmitPush(r0); |
| 2324 frame_->CallRuntime(Runtime::kNewClosure, 2); | 2324 frame_->CallRuntime(Runtime::kNewClosure, 2); |
| 2325 frame_->EmitPush(r0); | 2325 frame_->EmitPush(r0); |
| 2326 } | 2326 } |
| 2327 } | 2327 } |
| 2328 | 2328 |
| 2329 | 2329 |
| 2330 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { | 2330 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { |
| 2331 #ifdef DEBUG | 2331 #ifdef DEBUG |
| 2332 int original_height = frame_->height(); | 2332 int original_height = frame_->height(); |
| 2333 #endif | 2333 #endif |
| 2334 VirtualFrame::SpilledScope spilled_scope; | 2334 VirtualFrame::SpilledScope spilled_scope; |
| 2335 Comment cmnt(masm_, "[ FunctionLiteral"); | 2335 Comment cmnt(masm_, "[ FunctionLiteral"); |
| 2336 | 2336 |
| 2337 // Build the function boilerplate and instantiate it. | 2337 // Build the function info and instantiate it. |
| 2338 Handle<JSFunction> boilerplate = | 2338 Handle<SharedFunctionInfo> function_info = |
| 2339 Compiler::BuildBoilerplate(node, script(), this); | 2339 Compiler::BuildFunctionInfo(node, script(), this); |
| 2340 // Check for stack-overflow exception. | 2340 // Check for stack-overflow exception. |
| 2341 if (HasStackOverflow()) { | 2341 if (HasStackOverflow()) { |
| 2342 ASSERT(frame_->height() == original_height); | 2342 ASSERT(frame_->height() == original_height); |
| 2343 return; | 2343 return; |
| 2344 } | 2344 } |
| 2345 InstantiateBoilerplate(boilerplate); | 2345 InstantiateFunction(function_info); |
| 2346 ASSERT(frame_->height() == original_height + 1); | 2346 ASSERT(frame_->height() == original_height + 1); |
| 2347 } | 2347 } |
| 2348 | 2348 |
| 2349 | 2349 |
| 2350 void CodeGenerator::VisitFunctionBoilerplateLiteral( | 2350 void CodeGenerator::VisitSharedFunctionInfoLiteral( |
| 2351 FunctionBoilerplateLiteral* node) { | 2351 SharedFunctionInfoLiteral* node) { |
| 2352 #ifdef DEBUG | 2352 #ifdef DEBUG |
| 2353 int original_height = frame_->height(); | 2353 int original_height = frame_->height(); |
| 2354 #endif | 2354 #endif |
| 2355 VirtualFrame::SpilledScope spilled_scope; | 2355 VirtualFrame::SpilledScope spilled_scope; |
| 2356 Comment cmnt(masm_, "[ FunctionBoilerplateLiteral"); | 2356 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); |
| 2357 InstantiateBoilerplate(node->boilerplate()); | 2357 InstantiateFunction(node->shared_function_info()); |
| 2358 ASSERT(frame_->height() == original_height + 1); | 2358 ASSERT(frame_->height() == original_height + 1); |
| 2359 } | 2359 } |
| 2360 | 2360 |
| 2361 | 2361 |
| 2362 void CodeGenerator::VisitConditional(Conditional* node) { | 2362 void CodeGenerator::VisitConditional(Conditional* node) { |
| 2363 #ifdef DEBUG | 2363 #ifdef DEBUG |
| 2364 int original_height = frame_->height(); | 2364 int original_height = frame_->height(); |
| 2365 #endif | 2365 #endif |
| 2366 VirtualFrame::SpilledScope spilled_scope; | 2366 VirtualFrame::SpilledScope spilled_scope; |
| 2367 Comment cmnt(masm_, "[ Conditional"); | 2367 Comment cmnt(masm_, "[ Conditional"); |
| (...skipping 5676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8044 | 8044 |
| 8045 // Just jump to runtime to add the two strings. | 8045 // Just jump to runtime to add the two strings. |
| 8046 __ bind(&string_add_runtime); | 8046 __ bind(&string_add_runtime); |
| 8047 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 8047 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
| 8048 } | 8048 } |
| 8049 | 8049 |
| 8050 | 8050 |
| 8051 #undef __ | 8051 #undef __ |
| 8052 | 8052 |
| 8053 } } // namespace v8::internal | 8053 } } // namespace v8::internal |
| OLD | NEW |