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 | |
388 int ScopeInfo::ParameterEntriesIndex() { | 365 int ScopeInfo::ParameterEntriesIndex() { |
389 ASSERT(length() > 0); | 366 ASSERT(length() > 0); |
390 return kVariablePartIndex; | 367 return kVariablePartIndex; |
391 } | 368 } |
392 | 369 |
393 | 370 |
394 int ScopeInfo::StackLocalEntriesIndex() { | 371 int ScopeInfo::StackLocalEntriesIndex() { |
395 return ParameterEntriesIndex() + ParameterCount(); | 372 return ParameterEntriesIndex() + ParameterCount(); |
396 } | 373 } |
397 | 374 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } else { | 527 } else { |
551 ASSERT(var->index() >= 0); | 528 ASSERT(var->index() >= 0); |
552 info->set_index(i, var->index()); | 529 info->set_index(i, var->index()); |
553 } | 530 } |
554 } | 531 } |
555 ASSERT(i == info->length()); | 532 ASSERT(i == info->length()); |
556 return info; | 533 return info; |
557 } | 534 } |
558 | 535 |
559 } } // namespace v8::internal | 536 } } // namespace v8::internal |
OLD | NEW |