| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 | 131 |
| 132 Object* DeclareGlobals(Isolate* isolate, Handle<FixedArray> declarations, | 132 Object* DeclareGlobals(Isolate* isolate, Handle<FixedArray> declarations, |
| 133 int flags, Handle<TypeFeedbackVector> feedback_vector) { | 133 int flags, Handle<TypeFeedbackVector> feedback_vector) { |
| 134 HandleScope scope(isolate); | 134 HandleScope scope(isolate); |
| 135 Handle<JSGlobalObject> global(isolate->global_object()); | 135 Handle<JSGlobalObject> global(isolate->global_object()); |
| 136 Handle<Context> context(isolate->context()); | 136 Handle<Context> context(isolate->context()); |
| 137 | 137 |
| 138 // Traverse the name/value pairs and set the properties. | 138 // Traverse the name/value pairs and set the properties. |
| 139 int length = declarations->length(); | 139 int length = declarations->length(); |
| 140 FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < length, i += 3, { | 140 FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < length, i += 4, { |
| 141 Handle<String> name(String::cast(declarations->get(i)), isolate); | 141 Handle<String> name(String::cast(declarations->get(i)), isolate); |
| 142 FeedbackVectorSlot slot(Smi::cast(declarations->get(i + 1))->value()); | 142 FeedbackVectorSlot slot(Smi::cast(declarations->get(i + 1))->value()); |
| 143 Handle<Object> initial_value(declarations->get(i + 2), isolate); | 143 Handle<Object> initial_value(declarations->get(i + 3), isolate); |
| 144 | 144 |
| 145 bool is_var = initial_value->IsUndefined(isolate); | 145 bool is_var = initial_value->IsUndefined(isolate); |
| 146 bool is_function = initial_value->IsSharedFunctionInfo(); | 146 bool is_function = initial_value->IsSharedFunctionInfo(); |
| 147 DCHECK_EQ(1, BoolToInt(is_var) + BoolToInt(is_function)); | 147 DCHECK_EQ(1, BoolToInt(is_var) + BoolToInt(is_function)); |
| 148 | 148 |
| 149 Handle<Object> value; | 149 Handle<Object> value; |
| 150 if (is_function) { | 150 if (is_function) { |
| 151 // Copy the function and update its context. Use it as value. | 151 // Copy the function and update its context. Use it as value. |
| 152 Handle<SharedFunctionInfo> shared = | 152 Handle<SharedFunctionInfo> shared = |
| 153 Handle<SharedFunctionInfo>::cast(initial_value); | 153 Handle<SharedFunctionInfo>::cast(initial_value); |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { | 979 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { |
| 980 HandleScope scope(isolate); | 980 HandleScope scope(isolate); |
| 981 DCHECK_EQ(2, args.length()); | 981 DCHECK_EQ(2, args.length()); |
| 982 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 982 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 983 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 983 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 984 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); | 984 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); |
| 985 } | 985 } |
| 986 | 986 |
| 987 } // namespace internal | 987 } // namespace internal |
| 988 } // namespace v8 | 988 } // namespace v8 |
| OLD | NEW |