Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 int Scope::ContextChainLength(Scope* scope) { | 406 int Scope::ContextChainLength(Scope* scope) { |
| 407 int n = 0; | 407 int n = 0; |
| 408 for (Scope* s = this; s != scope; s = s->outer_scope_) { | 408 for (Scope* s = this; s != scope; s = s->outer_scope_) { |
| 409 ASSERT(s != NULL); // scope must be in the scope chain | 409 ASSERT(s != NULL); // scope must be in the scope chain |
| 410 if (s->num_heap_slots() > 0) n++; | 410 if (s->num_heap_slots() > 0) n++; |
| 411 } | 411 } |
| 412 return n; | 412 return n; |
| 413 } | 413 } |
| 414 | 414 |
| 415 | 415 |
| 416 bool Scope::IsParameterDeclared(Handle<String> name) { | |
| 417 for (int i = 0, length = num_parameters(); i < length; i ++) { | |
|
Lasse Reichstein
2011/01/18 13:40:59
Perhaps ASSERT that both name and parameter(i)->na
Martin Maly
2011/01/18 16:46:38
Done.
| |
| 418 if (name.is_identical_to(parameter(i)->name())) { | |
| 419 return true; | |
| 420 } | |
| 421 } | |
| 422 return false; | |
| 423 } | |
| 424 | |
| 425 | |
| 416 #ifdef DEBUG | 426 #ifdef DEBUG |
| 417 static const char* Header(Scope::Type type) { | 427 static const char* Header(Scope::Type type) { |
| 418 switch (type) { | 428 switch (type) { |
| 419 case Scope::EVAL_SCOPE: return "eval"; | 429 case Scope::EVAL_SCOPE: return "eval"; |
| 420 case Scope::FUNCTION_SCOPE: return "function"; | 430 case Scope::FUNCTION_SCOPE: return "function"; |
| 421 case Scope::GLOBAL_SCOPE: return "global"; | 431 case Scope::GLOBAL_SCOPE: return "global"; |
| 422 } | 432 } |
| 423 UNREACHABLE(); | 433 UNREACHABLE(); |
| 424 return NULL; | 434 return NULL; |
| 425 } | 435 } |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 973 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && | 983 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && |
| 974 !must_have_local_context) { | 984 !must_have_local_context) { |
| 975 num_heap_slots_ = 0; | 985 num_heap_slots_ = 0; |
| 976 } | 986 } |
| 977 | 987 |
| 978 // Allocation done. | 988 // Allocation done. |
| 979 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); | 989 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); |
| 980 } | 990 } |
| 981 | 991 |
| 982 } } // namespace v8::internal | 992 } } // namespace v8::internal |
| OLD | NEW |