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

Side by Side Diff: src/hydrogen.cc

Issue 12613004: To fully support hydrogen code stubs which accept a variable number of arguments, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: The start environment for a hydrogen stub is initialized twice (fixed). Created 7 years, 9 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 | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('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 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 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 length = new(graph()->zone()) HCheckSmiOrInt32(length); 868 length = new(graph()->zone()) HCheckSmiOrInt32(length);
869 AddInstruction(HCheckSmiOrInt32::cast(length)); 869 AddInstruction(HCheckSmiOrInt32::cast(length));
870 } 870 }
871 HBoundsCheck* result = new(graph()->zone()) HBoundsCheck( 871 HBoundsCheck* result = new(graph()->zone()) HBoundsCheck(
872 index, length, key_mode, r); 872 index, length, key_mode, r);
873 AddInstruction(result); 873 AddInstruction(result);
874 return result; 874 return result;
875 } 875 }
876 876
877 877
878 HReturn* HGraphBuilder::AddReturn(HValue* value) {
879 HValue* context = environment()->LookupContext();
880 int num_parameters = graph()->info()->num_parameters();
881 HValue* params = AddInstruction(new(graph()->zone())
882 HConstant(num_parameters, Representation::Integer32()));
883 HReturn* return_instruction = new(graph()->zone())
884 HReturn(value, context, params);
885 current_block()->FinishExit(return_instruction);
886 return return_instruction;
887 }
888
889
878 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) { 890 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) {
879 HBasicBlock* b = graph()->CreateBasicBlock(); 891 HBasicBlock* b = graph()->CreateBasicBlock();
880 b->SetInitialEnvironment(env); 892 b->SetInitialEnvironment(env);
881 return b; 893 return b;
882 } 894 }
883 895
884 896
885 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() { 897 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() {
886 HBasicBlock* header = graph()->CreateBasicBlock(); 898 HBasicBlock* header = graph()->CreateBasicBlock();
887 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header); 899 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header);
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 phi_list_(NULL), 1230 phi_list_(NULL),
1219 uint32_instructions_(NULL), 1231 uint32_instructions_(NULL),
1220 info_(info), 1232 info_(info),
1221 zone_(info->zone()), 1233 zone_(info->zone()),
1222 is_recursive_(false), 1234 is_recursive_(false),
1223 use_optimistic_licm_(false), 1235 use_optimistic_licm_(false),
1224 has_soft_deoptimize_(false), 1236 has_soft_deoptimize_(false),
1225 type_change_checksum_(0) { 1237 type_change_checksum_(0) {
1226 if (info->IsStub()) { 1238 if (info->IsStub()) {
1227 HydrogenCodeStub* stub = info->code_stub(); 1239 HydrogenCodeStub* stub = info->code_stub();
1228 int param_count = 1240 CodeStubInterfaceDescriptor* descriptor =
1229 stub->GetInterfaceDescriptor(isolate_)->register_param_count_; 1241 stub->GetInterfaceDescriptor(isolate_);
1230 start_environment_ = 1242 start_environment_ =
1231 new(zone_) HEnvironment(zone_, param_count); 1243 new(zone_) HEnvironment(zone_, descriptor->environment_length());
1232 } else { 1244 } else {
1233 start_environment_ = 1245 start_environment_ =
1234 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); 1246 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_);
1235 } 1247 }
1236 start_environment_->set_ast_id(BailoutId::FunctionEntry()); 1248 start_environment_->set_ast_id(BailoutId::FunctionEntry());
1237 entry_block_ = CreateBasicBlock(); 1249 entry_block_ = CreateBasicBlock();
1238 entry_block_->SetInitialEnvironment(start_environment_); 1250 entry_block_->SetInitialEnvironment(start_environment_);
1239 } 1251 }
1240 1252
1241 1253
(...skipping 2592 matching lines...) Expand 10 before | Expand all | Expand 10 after
3834 AddSimulate(BailoutId::Declarations()); 3846 AddSimulate(BailoutId::Declarations());
3835 3847
3836 HValue* context = environment()->LookupContext(); 3848 HValue* context = environment()->LookupContext();
3837 AddInstruction( 3849 AddInstruction(
3838 new(zone()) HStackCheck(context, HStackCheck::kFunctionEntry)); 3850 new(zone()) HStackCheck(context, HStackCheck::kFunctionEntry));
3839 3851
3840 VisitStatements(info()->function()->body()); 3852 VisitStatements(info()->function()->body());
3841 if (HasStackOverflow()) return false; 3853 if (HasStackOverflow()) return false;
3842 3854
3843 if (current_block() != NULL) { 3855 if (current_block() != NULL) {
3844 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined(), 3856 AddReturn(graph()->GetConstantUndefined());
3845 context);
3846 current_block()->FinishExit(instr);
3847 set_current_block(NULL); 3857 set_current_block(NULL);
3848 } 3858 }
3849 3859
3850 // If the checksum of the number of type info changes is the same as the 3860 // If the checksum of the number of type info changes is the same as the
3851 // last time this function was compiled, then this recompile is likely not 3861 // last time this function was compiled, then this recompile is likely not
3852 // due to missing/inadequate type feedback, but rather too aggressive 3862 // due to missing/inadequate type feedback, but rather too aggressive
3853 // optimization. Disable optimistic LICM in that case. 3863 // optimization. Disable optimistic LICM in that case.
3854 Handle<Code> unoptimized_code(info()->shared_info()->code()); 3864 Handle<Code> unoptimized_code(info()->shared_info()->code());
3855 ASSERT(unoptimized_code->kind() == Code::FUNCTION); 3865 ASSERT(unoptimized_code->kind() == Code::FUNCTION);
3856 Handle<TypeFeedbackInfo> type_info( 3866 Handle<TypeFeedbackInfo> type_info(
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
4719 void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { 4729 void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) {
4720 ASSERT(!HasStackOverflow()); 4730 ASSERT(!HasStackOverflow());
4721 ASSERT(current_block() != NULL); 4731 ASSERT(current_block() != NULL);
4722 ASSERT(current_block()->HasPredecessor()); 4732 ASSERT(current_block()->HasPredecessor());
4723 FunctionState* state = function_state(); 4733 FunctionState* state = function_state();
4724 AstContext* context = call_context(); 4734 AstContext* context = call_context();
4725 if (context == NULL) { 4735 if (context == NULL) {
4726 // Not an inlined return, so an actual one. 4736 // Not an inlined return, so an actual one.
4727 CHECK_ALIVE(VisitForValue(stmt->expression())); 4737 CHECK_ALIVE(VisitForValue(stmt->expression()));
4728 HValue* result = environment()->Pop(); 4738 HValue* result = environment()->Pop();
4729 current_block()->FinishExit(new(zone()) HReturn( 4739 AddReturn(result);
4730 result,
4731 environment()->LookupContext()));
4732 } else if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { 4740 } else if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) {
4733 // Return from an inlined construct call. In a test context the return value 4741 // Return from an inlined construct call. In a test context the return value
4734 // will always evaluate to true, in a value context the return value needs 4742 // will always evaluate to true, in a value context the return value needs
4735 // to be a JSObject. 4743 // to be a JSObject.
4736 if (context->IsTest()) { 4744 if (context->IsTest()) {
4737 TestContext* test = TestContext::cast(context); 4745 TestContext* test = TestContext::cast(context);
4738 CHECK_ALIVE(VisitForEffect(stmt->expression())); 4746 CHECK_ALIVE(VisitForEffect(stmt->expression()));
4739 current_block()->Goto(test->if_true(), state); 4747 current_block()->Goto(test->if_true(), state);
4740 } else if (context->IsEffect()) { 4748 } else if (context->IsEffect()) {
4741 CHECK_ALIVE(VisitForEffect(stmt->expression())); 4749 CHECK_ALIVE(VisitForEffect(stmt->expression()));
(...skipping 6121 matching lines...) Expand 10 before | Expand all | Expand 10 after
10863 } 10871 }
10864 } 10872 }
10865 10873
10866 #ifdef DEBUG 10874 #ifdef DEBUG
10867 if (graph_ != NULL) graph_->Verify(false); // No full verify. 10875 if (graph_ != NULL) graph_->Verify(false); // No full verify.
10868 if (allocator_ != NULL) allocator_->Verify(); 10876 if (allocator_ != NULL) allocator_->Verify();
10869 #endif 10877 #endif
10870 } 10878 }
10871 10879
10872 } } // namespace v8::internal 10880 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698