| 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 int local_count = ContextLocalCount(); |
| 370 if (local_count == 0) return true; |
| 371 // Fill all context locals to the context extension. |
| 372 int start = ContextLocalNameEntriesIndex(); |
| 373 int end = start + local_count; |
| 374 for (int i = start; i < end; ++i) { |
| 375 int context_index = Context::MIN_CONTEXT_SLOTS + i - start; |
| 376 RETURN_IF_EMPTY_HANDLE_VALUE( |
| 377 isolate, |
| 378 SetProperty(isolate, |
| 379 scope_object, |
| 380 Handle<String>(String::cast(get(i))), |
| 381 Handle<Object>(context->get(context_index), isolate), |
| 382 ::NONE, |
| 383 kNonStrictMode), |
| 384 false); |
| 385 } |
| 386 return true; |
| 387 } |
| 388 |
| 389 |
| 365 int ScopeInfo::ParameterEntriesIndex() { | 390 int ScopeInfo::ParameterEntriesIndex() { |
| 366 ASSERT(length() > 0); | 391 ASSERT(length() > 0); |
| 367 return kVariablePartIndex; | 392 return kVariablePartIndex; |
| 368 } | 393 } |
| 369 | 394 |
| 370 | 395 |
| 371 int ScopeInfo::StackLocalEntriesIndex() { | 396 int ScopeInfo::StackLocalEntriesIndex() { |
| 372 return ParameterEntriesIndex() + ParameterCount(); | 397 return ParameterEntriesIndex() + ParameterCount(); |
| 373 } | 398 } |
| 374 | 399 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 } else { | 552 } else { |
| 528 ASSERT(var->index() >= 0); | 553 ASSERT(var->index() >= 0); |
| 529 info->set_index(i, var->index()); | 554 info->set_index(i, var->index()); |
| 530 } | 555 } |
| 531 } | 556 } |
| 532 ASSERT(i == info->length()); | 557 ASSERT(i == info->length()); |
| 533 return info; | 558 return info; |
| 534 } | 559 } |
| 535 | 560 |
| 536 } } // namespace v8::internal | 561 } } // namespace v8::internal |
| OLD | NEW |