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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 if (FunctionVariableField::decode(Flags()) == CONTEXT && | 355 if (FunctionVariableField::decode(Flags()) == CONTEXT && |
356 FunctionName() == name) { | 356 FunctionName() == name) { |
357 *mode = FunctionVariableMode::decode(Flags()); | 357 *mode = FunctionVariableMode::decode(Flags()); |
358 return Smi::cast(get(FunctionNameEntryIndex() + 1))->value(); | 358 return Smi::cast(get(FunctionNameEntryIndex() + 1))->value(); |
359 } | 359 } |
360 } | 360 } |
361 return -1; | 361 return -1; |
362 } | 362 } |
363 | 363 |
364 | 364 |
| 365 bool ScopeInfo::CopyContextLocalsToScopeObject( |
| 366 Isolate* isolate, |
| 367 Handle<Context> context, |
| 368 Handle<JSObject> scope_object) { |
| 369 // Fill all context locals to the context extension. |
| 370 int start = ContextLocalNameEntriesIndex(); |
| 371 int end = start + ContextLocalCount(); |
| 372 for (int i = start; i < end; ++i) { |
| 373 int context_index = Context::MIN_CONTEXT_SLOTS + i - start; |
| 374 RETURN_IF_EMPTY_HANDLE_VALUE( |
| 375 isolate, |
| 376 SetProperty(isolate, |
| 377 scope_object, |
| 378 Handle<String>(String::cast(get(i))), |
| 379 Handle<Object>(context->get(context_index), isolate), |
| 380 ::NONE, |
| 381 kNonStrictMode), |
| 382 false); |
| 383 } |
| 384 return true; |
| 385 } |
| 386 |
| 387 |
365 int ScopeInfo::ParameterEntriesIndex() { | 388 int ScopeInfo::ParameterEntriesIndex() { |
366 ASSERT(length() > 0); | 389 ASSERT(length() > 0); |
367 return kVariablePartIndex; | 390 return kVariablePartIndex; |
368 } | 391 } |
369 | 392 |
370 | 393 |
371 int ScopeInfo::StackLocalEntriesIndex() { | 394 int ScopeInfo::StackLocalEntriesIndex() { |
372 return ParameterEntriesIndex() + ParameterCount(); | 395 return ParameterEntriesIndex() + ParameterCount(); |
373 } | 396 } |
374 | 397 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 } else { | 550 } else { |
528 ASSERT(var->index() >= 0); | 551 ASSERT(var->index() >= 0); |
529 info->set_index(i, var->index()); | 552 info->set_index(i, var->index()); |
530 } | 553 } |
531 } | 554 } |
532 ASSERT(i == info->length()); | 555 ASSERT(i == info->length()); |
533 return info; | 556 return info; |
534 } | 557 } |
535 | 558 |
536 } } // namespace v8::internal | 559 } } // namespace v8::internal |
OLD | NEW |