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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 23005027: Factor out HSimulate::ReplayEnvironment. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed commment by Ben Titzer. Created 7 years, 3 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-instructions.h ('k') | src/ia32/lithium-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 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 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 } else { 2282 } else {
2283 stream->Add(" push "); 2283 stream->Add(" push ");
2284 } 2284 }
2285 values_[i]->PrintNameTo(stream); 2285 values_[i]->PrintNameTo(stream);
2286 if (i > 0) stream->Add(","); 2286 if (i > 0) stream->Add(",");
2287 } 2287 }
2288 } 2288 }
2289 } 2289 }
2290 2290
2291 2291
2292 void HSimulate::ReplayEnvironment(HEnvironment* env) {
2293 ASSERT(env != NULL);
2294 env->set_ast_id(ast_id());
2295 env->Drop(pop_count());
2296 for (int i = values()->length() - 1; i >= 0; --i) {
2297 HValue* value = values()->at(i);
2298 if (HasAssignedIndexAt(i)) {
2299 env->Bind(GetAssignedIndexAt(i), value);
2300 } else {
2301 env->Push(value);
2302 }
2303 }
2304 }
2305
2306
2292 // Replay captured objects by replacing all captured objects with the 2307 // Replay captured objects by replacing all captured objects with the
2293 // same capture id in the current and all outer environments. 2308 // same capture id in the current and all outer environments.
2294 void HCapturedObject::ReplayEnvironment(HEnvironment* env) { 2309 void HCapturedObject::ReplayEnvironment(HEnvironment* env) {
2295 ASSERT(env != NULL); 2310 ASSERT(env != NULL);
2296 while (env != NULL) { 2311 while (env != NULL) {
2297 for (int i = 0; i < env->length(); ++i) { 2312 for (int i = 0; i < env->length(); ++i) {
2298 HValue* value = env->values()->at(i); 2313 HValue* value = env->values()->at(i);
2299 if (value->IsCapturedObject() && 2314 if (value->IsCapturedObject() &&
2300 HCapturedObject::cast(value)->capture_id() == this->capture_id()) { 2315 HCapturedObject::cast(value)->capture_id() == this->capture_id()) {
2301 env->SetValueAt(i, this); 2316 env->SetValueAt(i, this);
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
4011 break; 4026 break;
4012 case kExternalMemory: 4027 case kExternalMemory:
4013 stream->Add("[external-memory]"); 4028 stream->Add("[external-memory]");
4014 break; 4029 break;
4015 } 4030 }
4016 4031
4017 stream->Add("@%d", offset()); 4032 stream->Add("@%d", offset());
4018 } 4033 }
4019 4034
4020 } } // namespace v8::internal 4035 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698