OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3392 AddSimulate(BailoutId::Declarations()); | 3392 AddSimulate(BailoutId::Declarations()); |
3393 | 3393 |
3394 HValue* context = environment()->LookupContext(); | 3394 HValue* context = environment()->LookupContext(); |
3395 AddInstruction( | 3395 AddInstruction( |
3396 new(zone()) HStackCheck(context, HStackCheck::kFunctionEntry)); | 3396 new(zone()) HStackCheck(context, HStackCheck::kFunctionEntry)); |
3397 | 3397 |
3398 VisitStatements(info()->function()->body()); | 3398 VisitStatements(info()->function()->body()); |
3399 if (HasStackOverflow()) return false; | 3399 if (HasStackOverflow()) return false; |
3400 | 3400 |
3401 if (current_block() != NULL) { | 3401 if (current_block() != NULL) { |
3402 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined()); | 3402 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined(), |
| 3403 context); |
3403 current_block()->FinishExit(instr); | 3404 current_block()->FinishExit(instr); |
3404 set_current_block(NULL); | 3405 set_current_block(NULL); |
3405 } | 3406 } |
3406 | 3407 |
3407 // If the checksum of the number of type info changes is the same as the | 3408 // If the checksum of the number of type info changes is the same as the |
3408 // last time this function was compiled, then this recompile is likely not | 3409 // last time this function was compiled, then this recompile is likely not |
3409 // due to missing/inadequate type feedback, but rather too aggressive | 3410 // due to missing/inadequate type feedback, but rather too aggressive |
3410 // optimization. Disable optimistic LICM in that case. | 3411 // optimization. Disable optimistic LICM in that case. |
3411 Handle<Code> unoptimized_code(info()->shared_info()->code()); | 3412 Handle<Code> unoptimized_code(info()->shared_info()->code()); |
3412 ASSERT(unoptimized_code->kind() == Code::FUNCTION); | 3413 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4208 void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { | 4209 void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { |
4209 ASSERT(!HasStackOverflow()); | 4210 ASSERT(!HasStackOverflow()); |
4210 ASSERT(current_block() != NULL); | 4211 ASSERT(current_block() != NULL); |
4211 ASSERT(current_block()->HasPredecessor()); | 4212 ASSERT(current_block()->HasPredecessor()); |
4212 FunctionState* state = function_state(); | 4213 FunctionState* state = function_state(); |
4213 AstContext* context = call_context(); | 4214 AstContext* context = call_context(); |
4214 if (context == NULL) { | 4215 if (context == NULL) { |
4215 // Not an inlined return, so an actual one. | 4216 // Not an inlined return, so an actual one. |
4216 CHECK_ALIVE(VisitForValue(stmt->expression())); | 4217 CHECK_ALIVE(VisitForValue(stmt->expression())); |
4217 HValue* result = environment()->Pop(); | 4218 HValue* result = environment()->Pop(); |
4218 current_block()->FinishExit(new(zone()) HReturn(result)); | 4219 current_block()->FinishExit(new(zone()) HReturn( |
| 4220 result, |
| 4221 environment()->LookupContext())); |
4219 } else if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { | 4222 } else if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { |
4220 // Return from an inlined construct call. In a test context the return value | 4223 // Return from an inlined construct call. In a test context the return value |
4221 // will always evaluate to true, in a value context the return value needs | 4224 // will always evaluate to true, in a value context the return value needs |
4222 // to be a JSObject. | 4225 // to be a JSObject. |
4223 if (context->IsTest()) { | 4226 if (context->IsTest()) { |
4224 TestContext* test = TestContext::cast(context); | 4227 TestContext* test = TestContext::cast(context); |
4225 CHECK_ALIVE(VisitForEffect(stmt->expression())); | 4228 CHECK_ALIVE(VisitForEffect(stmt->expression())); |
4226 current_block()->Goto(test->if_true(), state); | 4229 current_block()->Goto(test->if_true(), state); |
4227 } else if (context->IsEffect()) { | 4230 } else if (context->IsEffect()) { |
4228 CHECK_ALIVE(VisitForEffect(stmt->expression())); | 4231 CHECK_ALIVE(VisitForEffect(stmt->expression())); |
(...skipping 5965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10194 } | 10197 } |
10195 } | 10198 } |
10196 | 10199 |
10197 #ifdef DEBUG | 10200 #ifdef DEBUG |
10198 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10201 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
10199 if (allocator_ != NULL) allocator_->Verify(); | 10202 if (allocator_ != NULL) allocator_->Verify(); |
10200 #endif | 10203 #endif |
10201 } | 10204 } |
10202 | 10205 |
10203 } } // namespace v8::internal | 10206 } } // namespace v8::internal |
OLD | NEW |