Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: src/hydrogen.cc

Issue 8286022: Revert r9619. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4521 matching lines...) Expand 10 before | Expand all | Expand 10 after
4532 TraceInline(target, caller, "target text too big"); 4532 TraceInline(target, caller, "target text too big");
4533 return false; 4533 return false;
4534 } 4534 }
4535 4535
4536 // Target must be inlineable. 4536 // Target must be inlineable.
4537 if (!target->IsInlineable()) { 4537 if (!target->IsInlineable()) {
4538 TraceInline(target, caller, "target not inlineable"); 4538 TraceInline(target, caller, "target not inlineable");
4539 return false; 4539 return false;
4540 } 4540 }
4541 4541
4542 CompilationInfo* outer_info = info();
4542 #if !defined(V8_TARGET_ARCH_IA32) 4543 #if !defined(V8_TARGET_ARCH_IA32)
4543 // Target must be able to use caller's context. 4544 // Target must be able to use caller's context.
4544 CompilationInfo* outer_info = info();
4545 if (target->context() != outer_info->closure()->context() || 4545 if (target->context() != outer_info->closure()->context() ||
4546 outer_info->scope()->contains_with() || 4546 outer_info->scope()->contains_with() ||
4547 outer_info->scope()->num_heap_slots() > 0) { 4547 outer_info->scope()->num_heap_slots() > 0) {
4548 TraceInline(target, caller, "target requires context change"); 4548 TraceInline(target, caller, "target requires context change");
4549 return false; 4549 return false;
4550 } 4550 }
4551 #endif 4551 #endif
4552 4552
4553 4553
4554 // Don't inline deeper than kMaxInliningLevels calls. 4554 // Don't inline deeper than kMaxInliningLevels calls.
4555 HEnvironment* env = environment(); 4555 HEnvironment* env = environment();
4556 int current_level = 1; 4556 int current_level = 1;
4557 while (env->outer() != NULL) { 4557 while (env->outer() != NULL) {
4558 if (current_level == Compiler::kMaxInliningLevels) { 4558 if (current_level == Compiler::kMaxInliningLevels) {
4559 TraceInline(target, caller, "inline depth limit reached"); 4559 TraceInline(target, caller, "inline depth limit reached");
4560 return false; 4560 return false;
4561 } 4561 }
4562 current_level++; 4562 current_level++;
4563 env = env->outer(); 4563 env = env->outer();
4564 } 4564 }
4565 4565
4566 // Don't inline recursive functions. 4566 // Don't inline recursive functions.
4567 for (FunctionState* state = function_state(); 4567 if (*target_shared == outer_info->closure()->shared()) {
4568 state != NULL; 4568 TraceInline(target, caller, "target is recursive");
4569 state = state->outer()) { 4569 return false;
4570 if (state->compilation_info()->closure()->shared() == *target_shared) {
4571 TraceInline(target, caller, "target is recursive");
4572 return false;
4573 }
4574 } 4570 }
4575 4571
4576 // We don't want to add more than a certain number of nodes from inlining. 4572 // We don't want to add more than a certain number of nodes from inlining.
4577 if (FLAG_limit_inlining && inlined_count_ > kMaxInlinedNodes) { 4573 if (FLAG_limit_inlining && inlined_count_ > kMaxInlinedNodes) {
4578 TraceInline(target, caller, "cumulative AST node limit reached"); 4574 TraceInline(target, caller, "cumulative AST node limit reached");
4579 return false; 4575 return false;
4580 } 4576 }
4581 4577
4582 int count_before = AstNode::Count(); 4578 int count_before = AstNode::Count();
4583 4579
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
5068 HGlobalObject* global = new(zone()) HGlobalObject(context); 5064 HGlobalObject* global = new(zone()) HGlobalObject(context);
5069 HGlobalReceiver* receiver = new(zone()) HGlobalReceiver(global); 5065 HGlobalReceiver* receiver = new(zone()) HGlobalReceiver(global);
5070 AddInstruction(global); 5066 AddInstruction(global);
5071 PushAndAdd(receiver); 5067 PushAndAdd(receiver);
5072 CHECK_ALIVE(VisitExpressions(expr->arguments())); 5068 CHECK_ALIVE(VisitExpressions(expr->arguments()));
5073 AddInstruction(new(zone()) HCheckFunction(function, expr->target())); 5069 AddInstruction(new(zone()) HCheckFunction(function, expr->target()));
5074 if (TryInline(expr)) { 5070 if (TryInline(expr)) {
5075 // The function is lingering in the deoptimization environment. 5071 // The function is lingering in the deoptimization environment.
5076 // Handle it by case analysis on the AST context. 5072 // Handle it by case analysis on the AST context.
5077 if (ast_context()->IsEffect()) { 5073 if (ast_context()->IsEffect()) {
5078 if (current_block() == NULL) return;
5079 ASSERT(Top() == function);
5080 Drop(1); 5074 Drop(1);
5081 } else if (ast_context()->IsValue()) { 5075 } else if (ast_context()->IsValue()) {
5082 if (current_block() == NULL) return;
5083 HValue* result = Pop(); 5076 HValue* result = Pop();
5084 ASSERT(Top() == function);
5085 Drop(1); 5077 Drop(1);
5086 Push(result); 5078 Push(result);
5087 } else if (ast_context()->IsTest()) { 5079 } else if (ast_context()->IsTest()) {
5088 ASSERT(current_block() == NULL);
5089 TestContext* context = TestContext::cast(ast_context()); 5080 TestContext* context = TestContext::cast(ast_context());
5090 if (context->if_true()->HasPredecessor() && 5081 if (context->if_true()->HasPredecessor()) {
5091 context->if_true()->last_environment()->Top() == function) {
5092 context->if_true()->last_environment()->Drop(1); 5082 context->if_true()->last_environment()->Drop(1);
5093 } 5083 }
5094 if (context->if_false()->HasPredecessor() && 5084 if (context->if_false()->HasPredecessor()) {
5095 context->if_false()->last_environment()->Top() == function) { 5085 context->if_true()->last_environment()->Drop(1);
5096 context->if_false()->last_environment()->Drop(1);
5097 } 5086 }
5098 } else { 5087 } else {
5099 UNREACHABLE(); 5088 UNREACHABLE();
5100 } 5089 }
5101 return; 5090 return;
5102 } else { 5091 } else {
5103 call = PreProcessCall(new(zone()) HInvokeFunction(context, 5092 call = PreProcessCall(new(zone()) HInvokeFunction(context,
5104 function, 5093 function,
5105 argument_count)); 5094 argument_count));
5106 Drop(1); // The function. 5095 Drop(1); // The function.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
5306 if (info.IsUninitialized()) { 5295 if (info.IsUninitialized()) {
5307 AddInstruction(new(zone()) HSoftDeoptimize); 5296 AddInstruction(new(zone()) HSoftDeoptimize);
5308 current_block()->MarkAsDeoptimizing(); 5297 current_block()->MarkAsDeoptimizing();
5309 } 5298 }
5310 HInstruction* instr = new(zone()) HBitNot(value); 5299 HInstruction* instr = new(zone()) HBitNot(value);
5311 return ast_context()->ReturnInstruction(instr, expr->id()); 5300 return ast_context()->ReturnInstruction(instr, expr->id());
5312 } 5301 }
5313 5302
5314 5303
5315 void HGraphBuilder::VisitNot(UnaryOperation* expr) { 5304 void HGraphBuilder::VisitNot(UnaryOperation* expr) {
5305 // TODO(svenpanne) Perhaps a switch/virtual function is nicer here.
5316 if (ast_context()->IsTest()) { 5306 if (ast_context()->IsTest()) {
5317 TestContext* context = TestContext::cast(ast_context()); 5307 TestContext* context = TestContext::cast(ast_context());
5318 VisitForControl(expr->expression(), 5308 VisitForControl(expr->expression(),
5319 context->if_false(), 5309 context->if_false(),
5320 context->if_true()); 5310 context->if_true());
5321 return; 5311 return;
5322 } 5312 }
5323 5313
5324 if (ast_context()->IsEffect()) { 5314 if (ast_context()->IsEffect()) {
5325 VisitForEffect(expr->expression()); 5315 VisitForEffect(expr->expression());
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
6987 } 6977 }
6988 } 6978 }
6989 6979
6990 #ifdef DEBUG 6980 #ifdef DEBUG
6991 if (graph_ != NULL) graph_->Verify(false); // No full verify. 6981 if (graph_ != NULL) graph_->Verify(false); // No full verify.
6992 if (allocator_ != NULL) allocator_->Verify(); 6982 if (allocator_ != NULL) allocator_->Verify();
6993 #endif 6983 #endif
6994 } 6984 }
6995 6985
6996 } } // namespace v8::internal 6986 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698