| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 if (FunctionVariableField::decode(Flags()) == CONTEXT && | 356 if (FunctionVariableField::decode(Flags()) == CONTEXT && |
| 357 FunctionName() == name) { | 357 FunctionName() == name) { |
| 358 *mode = FunctionVariableMode::decode(Flags()); | 358 *mode = FunctionVariableMode::decode(Flags()); |
| 359 return Smi::cast(get(FunctionNameEntryIndex() + 1))->value(); | 359 return Smi::cast(get(FunctionNameEntryIndex() + 1))->value(); |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 return -1; | 362 return -1; |
| 363 } | 363 } |
| 364 | 364 |
| 365 | 365 |
| 366 bool ScopeInfo::CopyContextLocalsToScopeObject( | 366 bool ScopeInfo::CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info, |
| 367 Isolate* isolate, | 367 Handle<Context> context, |
| 368 Handle<Context> context, | 368 Handle<JSObject> scope_object) { |
| 369 Handle<JSObject> scope_object) { | 369 Isolate* isolate = scope_info->GetIsolate(); |
| 370 int local_count = ContextLocalCount(); | 370 int local_count = scope_info->ContextLocalCount(); |
| 371 if (local_count == 0) return true; | 371 if (local_count == 0) return true; |
| 372 // Fill all context locals to the context extension. | 372 // Fill all context locals to the context extension. |
| 373 int start = ContextLocalNameEntriesIndex(); | 373 int start = scope_info->ContextLocalNameEntriesIndex(); |
| 374 int end = start + local_count; | 374 int end = start + local_count; |
| 375 for (int i = start; i < end; ++i) { | 375 for (int i = start; i < end; ++i) { |
| 376 int context_index = Context::MIN_CONTEXT_SLOTS + i - start; | 376 int context_index = Context::MIN_CONTEXT_SLOTS + i - start; |
| 377 RETURN_IF_EMPTY_HANDLE_VALUE( | 377 RETURN_IF_EMPTY_HANDLE_VALUE( |
| 378 isolate, | 378 isolate, |
| 379 SetProperty(isolate, | 379 SetProperty(isolate, |
| 380 scope_object, | 380 scope_object, |
| 381 Handle<String>(String::cast(get(i))), | 381 Handle<String>(String::cast(scope_info->get(i))), |
| 382 Handle<Object>(context->get(context_index), isolate), | 382 Handle<Object>(context->get(context_index), isolate), |
| 383 ::NONE, | 383 ::NONE, |
| 384 kNonStrictMode), | 384 kNonStrictMode), |
| 385 false); | 385 false); |
| 386 } | 386 } |
| 387 return true; | 387 return true; |
| 388 } | 388 } |
| 389 | 389 |
| 390 | 390 |
| 391 int ScopeInfo::ParameterEntriesIndex() { | 391 int ScopeInfo::ParameterEntriesIndex() { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 } else { | 555 } else { |
| 556 ASSERT(var->index() >= 0); | 556 ASSERT(var->index() >= 0); |
| 557 info->set_index(i, var->index()); | 557 info->set_index(i, var->index()); |
| 558 } | 558 } |
| 559 } | 559 } |
| 560 ASSERT(i == info->length()); | 560 ASSERT(i == info->length()); |
| 561 return info; | 561 return info; |
| 562 } | 562 } |
| 563 | 563 |
| 564 } } // namespace v8::internal | 564 } } // namespace v8::internal |
| OLD | NEW |