OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/scopeinfo.h" | 9 #include "src/scopeinfo.h" |
10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 int local_count = scope_info->ContextLocalCount(); | 361 int local_count = scope_info->ContextLocalCount(); |
362 if (local_count == 0) return true; | 362 if (local_count == 0) return true; |
363 // Fill all context locals to the context extension. | 363 // Fill all context locals to the context extension. |
364 int first_context_var = scope_info->StackLocalCount(); | 364 int first_context_var = scope_info->StackLocalCount(); |
365 int start = scope_info->ContextLocalNameEntriesIndex(); | 365 int start = scope_info->ContextLocalNameEntriesIndex(); |
366 for (int i = 0; i < local_count; ++i) { | 366 for (int i = 0; i < local_count; ++i) { |
367 if (scope_info->LocalIsSynthetic(first_context_var + i)) continue; | 367 if (scope_info->LocalIsSynthetic(first_context_var + i)) continue; |
368 int context_index = Context::MIN_CONTEXT_SLOTS + i; | 368 int context_index = Context::MIN_CONTEXT_SLOTS + i; |
369 RETURN_ON_EXCEPTION_VALUE( | 369 RETURN_ON_EXCEPTION_VALUE( |
370 isolate, | 370 isolate, |
371 Runtime::SetObjectProperty( | 371 Runtime::DefineObjectProperty( |
372 isolate, | |
373 scope_object, | 372 scope_object, |
374 Handle<String>(String::cast(scope_info->get(i + start))), | 373 Handle<String>(String::cast(scope_info->get(i + start))), |
375 Handle<Object>(context->get(context_index), isolate), | 374 Handle<Object>(context->get(context_index), isolate), |
376 ::NONE, | 375 ::NONE), |
377 SLOPPY), | |
378 false); | 376 false); |
379 } | 377 } |
380 return true; | 378 return true; |
381 } | 379 } |
382 | 380 |
383 | 381 |
384 int ScopeInfo::ParameterEntriesIndex() { | 382 int ScopeInfo::ParameterEntriesIndex() { |
385 ASSERT(length() > 0); | 383 ASSERT(length() > 0); |
386 return kVariablePartIndex; | 384 return kVariablePartIndex; |
387 } | 385 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } else { | 548 } else { |
551 ASSERT(var->index() >= 0); | 549 ASSERT(var->index() >= 0); |
552 info->set_index(i, var->index()); | 550 info->set_index(i, var->index()); |
553 } | 551 } |
554 } | 552 } |
555 ASSERT(i == info->length()); | 553 ASSERT(i == info->length()); |
556 return info; | 554 return info; |
557 } | 555 } |
558 | 556 |
559 } } // namespace v8::internal | 557 } } // namespace v8::internal |
OLD | NEW |