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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 300 } |
301 | 301 |
302 | 302 |
303 bool ScopeInfo::LocalIsSynthetic(int var) { | 303 bool ScopeInfo::LocalIsSynthetic(int var) { |
304 DCHECK(0 <= var && var < LocalCount()); | 304 DCHECK(0 <= var && var < LocalCount()); |
305 // There's currently no flag stored on the ScopeInfo to indicate that a | 305 // There's currently no flag stored on the ScopeInfo to indicate that a |
306 // variable is a compiler-introduced temporary. However, to avoid conflict | 306 // variable is a compiler-introduced temporary. However, to avoid conflict |
307 // with user declarations, the current temporaries like .generator_object and | 307 // with user declarations, the current temporaries like .generator_object and |
308 // .result start with a dot, so we can use that as a flag. It's a hack! | 308 // .result start with a dot, so we can use that as a flag. It's a hack! |
309 Handle<String> name(LocalName(var)); | 309 Handle<String> name(LocalName(var)); |
310 return name->length() > 0 && name->Get(0) == '.'; | 310 return (name->length() > 0 && name->Get(0) == '.') || |
| 311 name->Equals(*GetIsolate()->factory()->this_string()); |
311 } | 312 } |
312 | 313 |
313 | 314 |
314 String* ScopeInfo::StrongModeFreeVariableName(int var) { | 315 String* ScopeInfo::StrongModeFreeVariableName(int var) { |
315 DCHECK(0 <= var && var < StrongModeFreeVariableCount()); | 316 DCHECK(0 <= var && var < StrongModeFreeVariableCount()); |
316 int info_index = StrongModeFreeVariableNameEntriesIndex() + var; | 317 int info_index = StrongModeFreeVariableNameEntriesIndex() + var; |
317 return String::cast(get(info_index)); | 318 return String::cast(get(info_index)); |
318 } | 319 } |
319 | 320 |
320 | 321 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 info->set_name(i, *(it.export_name()->string())); | 644 info->set_name(i, *(it.export_name()->string())); |
644 info->set_mode(i, var->mode()); | 645 info->set_mode(i, var->mode()); |
645 DCHECK(var->index() >= 0); | 646 DCHECK(var->index() >= 0); |
646 info->set_index(i, var->index()); | 647 info->set_index(i, var->index()); |
647 } | 648 } |
648 DCHECK(i == info->length()); | 649 DCHECK(i == info->length()); |
649 return info; | 650 return info; |
650 } | 651 } |
651 | 652 |
652 } } // namespace v8::internal | 653 } } // namespace v8::internal |
OLD | NEW |