| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 373                                                Handle<JSObject> scope_object) { | 373                                                Handle<JSObject> scope_object) { | 
| 374   Isolate* isolate = scope_info->GetIsolate(); | 374   Isolate* isolate = scope_info->GetIsolate(); | 
| 375   int local_count = scope_info->ContextLocalCount(); | 375   int local_count = scope_info->ContextLocalCount(); | 
| 376   if (local_count == 0) return true; | 376   if (local_count == 0) return true; | 
| 377   // Fill all context locals to the context extension. | 377   // Fill all context locals to the context extension. | 
| 378   int first_context_var = scope_info->StackLocalCount(); | 378   int first_context_var = scope_info->StackLocalCount(); | 
| 379   int start = scope_info->ContextLocalNameEntriesIndex(); | 379   int start = scope_info->ContextLocalNameEntriesIndex(); | 
| 380   for (int i = 0; i < local_count; ++i) { | 380   for (int i = 0; i < local_count; ++i) { | 
| 381     if (scope_info->LocalIsSynthetic(first_context_var + i)) continue; | 381     if (scope_info->LocalIsSynthetic(first_context_var + i)) continue; | 
| 382     int context_index = Context::MIN_CONTEXT_SLOTS + i; | 382     int context_index = Context::MIN_CONTEXT_SLOTS + i; | 
|  | 383     Handle<Object> value = Handle<Object>(context->get(context_index), isolate); | 
|  | 384     // Do not reflect variables under TDZ in scope object. | 
|  | 385     if (value->IsTheHole()) continue; | 
| 383     RETURN_ON_EXCEPTION_VALUE( | 386     RETURN_ON_EXCEPTION_VALUE( | 
| 384         isolate, | 387         isolate, Runtime::DefineObjectProperty( | 
| 385         Runtime::DefineObjectProperty( | 388                      scope_object, | 
| 386             scope_object, | 389                      Handle<String>(String::cast(scope_info->get(i + start))), | 
| 387             Handle<String>(String::cast(scope_info->get(i + start))), | 390                      value, ::NONE), | 
| 388             Handle<Object>(context->get(context_index), isolate), |  | 
| 389             ::NONE), |  | 
| 390         false); | 391         false); | 
| 391   } | 392   } | 
| 392   return true; | 393   return true; | 
| 393 } | 394 } | 
| 394 | 395 | 
| 395 | 396 | 
| 396 int ScopeInfo::ParameterEntriesIndex() { | 397 int ScopeInfo::ParameterEntriesIndex() { | 
| 397   DCHECK(length() > 0); | 398   DCHECK(length() > 0); | 
| 398   return kVariablePartIndex; | 399   return kVariablePartIndex; | 
| 399 } | 400 } | 
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 564     } else { | 565     } else { | 
| 565       DCHECK(var->index() >= 0); | 566       DCHECK(var->index() >= 0); | 
| 566       info->set_index(i, var->index()); | 567       info->set_index(i, var->index()); | 
| 567     } | 568     } | 
| 568   } | 569   } | 
| 569   DCHECK(i == info->length()); | 570   DCHECK(i == info->length()); | 
| 570   return info; | 571   return info; | 
| 571 } | 572 } | 
| 572 | 573 | 
| 573 } }  // namespace v8::internal | 574 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|