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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 } | 354 } |
355 | 355 |
356 | 356 |
357 void Scope::AddParameter(Variable* var) { | 357 void Scope::AddParameter(Variable* var) { |
358 ASSERT(is_function_scope()); | 358 ASSERT(is_function_scope()); |
359 ASSERT(LocalLookup(var->name()) == var); | 359 ASSERT(LocalLookup(var->name()) == var); |
360 params_.Add(var); | 360 params_.Add(var); |
361 } | 361 } |
362 | 362 |
363 | 363 |
364 VariableProxy* Scope::NewUnresolved(Handle<String> name, bool inside_with) { | 364 VariableProxy* Scope::NewUnresolved(Handle<String> name, |
| 365 bool inside_with, |
| 366 int position) { |
365 // Note that we must not share the unresolved variables with | 367 // Note that we must not share the unresolved variables with |
366 // the same name because they may be removed selectively via | 368 // the same name because they may be removed selectively via |
367 // RemoveUnresolved(). | 369 // RemoveUnresolved(). |
368 ASSERT(!resolved()); | 370 ASSERT(!resolved()); |
369 VariableProxy* proxy = new VariableProxy(name, false, inside_with); | 371 VariableProxy* proxy = new VariableProxy(name, false, inside_with, position); |
370 unresolved_.Add(proxy); | 372 unresolved_.Add(proxy); |
371 return proxy; | 373 return proxy; |
372 } | 374 } |
373 | 375 |
374 | 376 |
375 void Scope::RemoveUnresolved(VariableProxy* var) { | 377 void Scope::RemoveUnresolved(VariableProxy* var) { |
376 // Most likely (always?) any variable we want to remove | 378 // Most likely (always?) any variable we want to remove |
377 // was just added before, so we search backwards. | 379 // was just added before, so we search backwards. |
378 for (int i = unresolved_.length(); i-- > 0;) { | 380 for (int i = unresolved_.length(); i-- > 0;) { |
379 if (unresolved_[i] == var) { | 381 if (unresolved_[i] == var) { |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && | 1084 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && |
1083 !must_have_local_context) { | 1085 !must_have_local_context) { |
1084 num_heap_slots_ = 0; | 1086 num_heap_slots_ = 0; |
1085 } | 1087 } |
1086 | 1088 |
1087 // Allocation done. | 1089 // Allocation done. |
1088 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); | 1090 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); |
1089 } | 1091 } |
1090 | 1092 |
1091 } } // namespace v8::internal | 1093 } } // namespace v8::internal |
OLD | NEW |