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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 const int parameter_count = scope->num_parameters(); | 47 const int parameter_count = scope->num_parameters(); |
48 const int length = kVariablePartIndex | 48 const int length = kVariablePartIndex |
49 + parameter_count + stack_local_count + 2 * context_local_count | 49 + parameter_count + stack_local_count + 2 * context_local_count |
50 + (has_function_name ? 2 : 0); | 50 + (has_function_name ? 2 : 0); |
51 | 51 |
52 Factory* factory = zone->isolate()->factory(); | 52 Factory* factory = zone->isolate()->factory(); |
53 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); | 53 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); |
54 | 54 |
55 // Encode the flags. | 55 // Encode the flags. |
56 int flags = ScopeTypeField::encode(scope->scope_type()) | | 56 int flags = ScopeTypeField::encode(scope->scope_type()) | |
57 CallsEvalField::encode(scope->calls_eval()) | | 57 CallsEvalField::encode(scope->calls_eval()) | |
58 StrictModeField::encode(scope->strict_mode()) | | 58 StrictModeField::encode(scope->strict_mode()) | |
59 FunctionVariableField::encode(function_name_info) | | 59 FunctionVariableField::encode(function_name_info) | |
60 FunctionVariableMode::encode(function_variable_mode); | 60 FunctionVariableMode::encode(function_variable_mode) | |
| 61 AsmModuleField::encode(scope->asm_module()) | |
| 62 AsmFunctionField::encode(scope->asm_function()); |
61 scope_info->SetFlags(flags); | 63 scope_info->SetFlags(flags); |
62 scope_info->SetParameterCount(parameter_count); | 64 scope_info->SetParameterCount(parameter_count); |
63 scope_info->SetStackLocalCount(stack_local_count); | 65 scope_info->SetStackLocalCount(stack_local_count); |
64 scope_info->SetContextLocalCount(context_local_count); | 66 scope_info->SetContextLocalCount(context_local_count); |
65 | 67 |
66 int index = kVariablePartIndex; | 68 int index = kVariablePartIndex; |
67 // Add parameters. | 69 // Add parameters. |
68 DCHECK(index == scope_info->ParameterEntriesIndex()); | 70 DCHECK(index == scope_info->ParameterEntriesIndex()); |
69 for (int i = 0; i < parameter_count; ++i) { | 71 for (int i = 0; i < parameter_count; ++i) { |
70 scope_info->set(index++, *scope->parameter(i)->name()); | 72 scope_info->set(index++, *scope->parameter(i)->name()); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 } else { | 564 } else { |
563 DCHECK(var->index() >= 0); | 565 DCHECK(var->index() >= 0); |
564 info->set_index(i, var->index()); | 566 info->set_index(i, var->index()); |
565 } | 567 } |
566 } | 568 } |
567 DCHECK(i == info->length()); | 569 DCHECK(i == info->length()); |
568 return info; | 570 return info; |
569 } | 571 } |
570 | 572 |
571 } } // namespace v8::internal | 573 } } // namespace v8::internal |
OLD | NEW |