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 |
2345 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, | 2354 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, |
2346 Zone* zone) { | 2355 Zone* zone) { |
2347 ASSERT(return_target->IsInlineReturnTarget()); | 2356 ASSERT(return_target->IsInlineReturnTarget()); |
2348 return_targets_.Add(return_target, zone); | 2357 return_targets_.Add(return_target, zone); |
2349 } | 2358 } |
(...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4199 break; | 4208 break; |
4200 case kExternalMemory: | 4209 case kExternalMemory: |
4201 stream->Add("[external-memory]"); | 4210 stream->Add("[external-memory]"); |
4202 break; | 4211 break; |
4203 } | 4212 } |
4204 | 4213 |
4205 stream->Add("@%d", offset()); | 4214 stream->Add("@%d", offset()); |
4206 } | 4215 } |
4207 | 4216 |
4208 } } // namespace v8::internal | 4217 } } // namespace v8::internal |
OLD | NEW |