| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 ASSERT(index < length()); | 441 ASSERT(index < length()); |
| 442 values_[index] = value; | 442 values_[index] = value; |
| 443 } | 443 } |
| 444 | 444 |
| 445 void PrintTo(StringStream* stream); | 445 void PrintTo(StringStream* stream); |
| 446 void PrintToStd(); | 446 void PrintToStd(); |
| 447 | 447 |
| 448 private: | 448 private: |
| 449 explicit HEnvironment(const HEnvironment* other); | 449 explicit HEnvironment(const HEnvironment* other); |
| 450 | 450 |
| 451 void CheckDepth() { | |
| 452 // Verify that we are not trying to create an | |
| 453 // impossibly deeply nested environment. | |
| 454 if (!FLAG_limit_inlining) return; | |
| 455 | |
| 456 static const int kMaxDepth = 4; | |
| 457 | |
| 458 int cnt = 0; | |
| 459 for (HEnvironment* env = this; | |
| 460 env != NULL && cnt <= kMaxDepth; // Check cnt to avoid infinite loop. | |
| 461 env = env->outer()) { | |
| 462 cnt++; | |
| 463 } | |
| 464 | |
| 465 CHECK(cnt <= kMaxDepth); | |
| 466 } | |
| 467 | |
| 468 // True if index is included in the expression stack part of the environment. | 451 // True if index is included in the expression stack part of the environment. |
| 469 bool HasExpressionAt(int index) const; | 452 bool HasExpressionAt(int index) const; |
| 470 | 453 |
| 471 void Initialize(int parameter_count, int local_count, int stack_height); | 454 void Initialize(int parameter_count, int local_count, int stack_height); |
| 472 void Initialize(const HEnvironment* other); | 455 void Initialize(const HEnvironment* other); |
| 473 | 456 |
| 474 // Map a variable to an environment index. Parameter indices are shifted | 457 // Map a variable to an environment index. Parameter indices are shifted |
| 475 // by 1 (receiver is parameter index -1 but environment index 0). | 458 // by 1 (receiver is parameter index -1 but environment index 0). |
| 476 // Stack-allocated local indices are shifted by the number of parameters. | 459 // Stack-allocated local indices are shifted by the number of parameters. |
| 477 int IndexFor(Variable* variable) const { | 460 int IndexFor(Variable* variable) const { |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 const char* filename_; | 1241 const char* filename_; |
| 1259 HeapStringAllocator string_allocator_; | 1242 HeapStringAllocator string_allocator_; |
| 1260 StringStream trace_; | 1243 StringStream trace_; |
| 1261 int indent_; | 1244 int indent_; |
| 1262 }; | 1245 }; |
| 1263 | 1246 |
| 1264 | 1247 |
| 1265 } } // namespace v8::internal | 1248 } } // namespace v8::internal |
| 1266 | 1249 |
| 1267 #endif // V8_HYDROGEN_H_ | 1250 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |