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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 310 } |
311 | 311 |
312 | 312 |
313 bool ScopeInfo::LocalIsSynthetic(int var) { | 313 bool ScopeInfo::LocalIsSynthetic(int var) { |
314 DCHECK(0 <= var && var < LocalCount()); | 314 DCHECK(0 <= var && var < LocalCount()); |
315 // There's currently no flag stored on the ScopeInfo to indicate that a | 315 // There's currently no flag stored on the ScopeInfo to indicate that a |
316 // variable is a compiler-introduced temporary. However, to avoid conflict | 316 // variable is a compiler-introduced temporary. However, to avoid conflict |
317 // with user declarations, the current temporaries like .generator_object and | 317 // with user declarations, the current temporaries like .generator_object and |
318 // .result start with a dot, so we can use that as a flag. It's a hack! | 318 // .result start with a dot, so we can use that as a flag. It's a hack! |
319 Handle<String> name(LocalName(var)); | 319 Handle<String> name(LocalName(var)); |
320 return (name->length() > 0 && name->Get(0) == '.') || | 320 return name->length() > 0 && name->Get(0) == '.'; |
321 name->Equals(*GetIsolate()->factory()->this_string()); | |
322 } | 321 } |
323 | 322 |
324 | 323 |
325 String* ScopeInfo::StrongModeFreeVariableName(int var) { | 324 String* ScopeInfo::StrongModeFreeVariableName(int var) { |
326 DCHECK(0 <= var && var < StrongModeFreeVariableCount()); | 325 DCHECK(0 <= var && var < StrongModeFreeVariableCount()); |
327 int info_index = StrongModeFreeVariableNameEntriesIndex() + var; | 326 int info_index = StrongModeFreeVariableNameEntriesIndex() + var; |
328 return String::cast(get(info_index)); | 327 return String::cast(get(info_index)); |
329 } | 328 } |
330 | 329 |
331 | 330 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 info->set_name(i, *(it.export_name()->string())); | 659 info->set_name(i, *(it.export_name()->string())); |
661 info->set_mode(i, var->mode()); | 660 info->set_mode(i, var->mode()); |
662 DCHECK(var->index() >= 0); | 661 DCHECK(var->index() >= 0); |
663 info->set_index(i, var->index()); | 662 info->set_index(i, var->index()); |
664 } | 663 } |
665 DCHECK(i == info->length()); | 664 DCHECK(i == info->length()); |
666 return info; | 665 return info; |
667 } | 666 } |
668 | 667 |
669 } } // namespace v8::internal | 668 } } // namespace v8::internal |
OLD | NEW |