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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index c2f3951494e647936183cdb1d25659c8d5ee187f..0feb119bc83ec39e31b04cc950a25fad07032afb 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -875,6 +875,18 @@ HBoundsCheck* HGraphBuilder::AddBoundsCheck(HValue* index,
}
+HReturn* HGraphBuilder::AddReturn(HValue* value) {
+ HValue* context = environment()->LookupContext();
+ int num_parameters = graph()->info()->num_parameters();
+ HValue* params = AddInstruction(new(graph()->zone())
+ HConstant(num_parameters, Representation::Integer32()));
+ HReturn* return_instruction = new(graph()->zone())
+ HReturn(value, context, params);
+ current_block()->FinishExit(return_instruction);
+ return return_instruction;
+}
+
+
HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) {
HBasicBlock* b = graph()->CreateBasicBlock();
b->SetInitialEnvironment(env);
@@ -1225,10 +1237,10 @@ HGraph::HGraph(CompilationInfo* info)
type_change_checksum_(0) {
if (info->IsStub()) {
HydrogenCodeStub* stub = info->code_stub();
- int param_count =
- stub->GetInterfaceDescriptor(isolate_)->register_param_count_;
+ CodeStubInterfaceDescriptor* descriptor =
+ stub->GetInterfaceDescriptor(isolate_);
start_environment_ =
- new(zone_) HEnvironment(zone_, param_count);
+ new(zone_) HEnvironment(zone_, descriptor->environment_length());
} else {
start_environment_ =
new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_);
@@ -3841,9 +3853,7 @@ bool HOptimizedGraphBuilder::BuildGraph() {
if (HasStackOverflow()) return false;
if (current_block() != NULL) {
- HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined(),
- context);
- current_block()->FinishExit(instr);
+ AddReturn(graph()->GetConstantUndefined());
set_current_block(NULL);
}
@@ -4726,9 +4736,7 @@ void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) {
// Not an inlined return, so an actual one.
CHECK_ALIVE(VisitForValue(stmt->expression()));
HValue* result = environment()->Pop();
- current_block()->FinishExit(new(zone()) HReturn(
- result,
- environment()->LookupContext()));
+ AddReturn(result);
} else if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) {
// Return from an inlined construct call. In a test context the return value
// will always evaluate to true, in a value context the return value needs
« 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