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 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 HValue* value = values()->at(i); | 2318 HValue* value = values()->at(i); |
2319 if (HasAssignedIndexAt(i)) { | 2319 if (HasAssignedIndexAt(i)) { |
2320 env->Bind(GetAssignedIndexAt(i), value); | 2320 env->Bind(GetAssignedIndexAt(i), value); |
2321 } else { | 2321 } else { |
2322 env->Push(value); | 2322 env->Push(value); |
2323 } | 2323 } |
2324 } | 2324 } |
2325 } | 2325 } |
2326 | 2326 |
2327 | 2327 |
| 2328 static void ReplayEnvironmentNested(const ZoneList<HValue*>* values, |
| 2329 HCapturedObject* other) { |
| 2330 for (int i = 0; i < values->length(); ++i) { |
| 2331 HValue* value = values->at(i); |
| 2332 if (value->IsCapturedObject()) { |
| 2333 if (HCapturedObject::cast(value)->capture_id() == other->capture_id()) { |
| 2334 values->at(i) = other; |
| 2335 } else { |
| 2336 ReplayEnvironmentNested(HCapturedObject::cast(value)->values(), other); |
| 2337 } |
| 2338 } |
| 2339 } |
| 2340 } |
| 2341 |
| 2342 |
2328 // Replay captured objects by replacing all captured objects with the | 2343 // Replay captured objects by replacing all captured objects with the |
2329 // same capture id in the current and all outer environments. | 2344 // same capture id in the current and all outer environments. |
2330 void HCapturedObject::ReplayEnvironment(HEnvironment* env) { | 2345 void HCapturedObject::ReplayEnvironment(HEnvironment* env) { |
2331 ASSERT(env != NULL); | 2346 ASSERT(env != NULL); |
2332 while (env != NULL) { | 2347 while (env != NULL) { |
2333 for (int i = 0; i < env->length(); ++i) { | 2348 ReplayEnvironmentNested(env->values(), this); |
2334 HValue* value = env->values()->at(i); | |
2335 if (value->IsCapturedObject() && | |
2336 HCapturedObject::cast(value)->capture_id() == this->capture_id()) { | |
2337 env->SetValueAt(i, this); | |
2338 } | |
2339 } | |
2340 env = env->outer(); | 2349 env = env->outer(); |
2341 } | 2350 } |
2342 } | 2351 } |
2343 | 2352 |
2344 | 2353 |
| 2354 void HCapturedObject::PrintDataTo(StringStream* stream) { |
| 2355 stream->Add("#%d ", capture_id()); |
| 2356 HDematerializedObject::PrintDataTo(stream); |
| 2357 } |
| 2358 |
| 2359 |
2345 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, | 2360 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, |
2346 Zone* zone) { | 2361 Zone* zone) { |
2347 ASSERT(return_target->IsInlineReturnTarget()); | 2362 ASSERT(return_target->IsInlineReturnTarget()); |
2348 return_targets_.Add(return_target, zone); | 2363 return_targets_.Add(return_target, zone); |
2349 } | 2364 } |
2350 | 2365 |
2351 | 2366 |
2352 void HEnterInlined::PrintDataTo(StringStream* stream) { | 2367 void HEnterInlined::PrintDataTo(StringStream* stream) { |
2353 SmartArrayPointer<char> name = function()->debug_name()->ToCString(); | 2368 SmartArrayPointer<char> name = function()->debug_name()->ToCString(); |
2354 stream->Add("%s, id=%d", *name, function()->id().ToInt()); | 2369 stream->Add("%s, id=%d", *name, function()->id().ToInt()); |
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4199 break; | 4214 break; |
4200 case kExternalMemory: | 4215 case kExternalMemory: |
4201 stream->Add("[external-memory]"); | 4216 stream->Add("[external-memory]"); |
4202 break; | 4217 break; |
4203 } | 4218 } |
4204 | 4219 |
4205 stream->Add("@%d", offset()); | 4220 stream->Add("@%d", offset()); |
4206 } | 4221 } |
4207 | 4222 |
4208 } } // namespace v8::internal | 4223 } } // namespace v8::internal |
OLD | NEW |