Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: src/runtime/runtime-scopes.cc

Issue 2645543002: Back strongly rooted literals CLs out of the tree for branch cut (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 += 4, { 140 FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < length, i += 3, {
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> possibly_literal_slot(declarations->get(i + 2), isolate); 143 Handle<Object> initial_value(declarations->get(i + 2), isolate);
144 Handle<Object> initial_value(declarations->get(i + 3), isolate);
145 144
146 bool is_var = initial_value->IsUndefined(isolate); 145 bool is_var = initial_value->IsUndefined(isolate);
147 bool is_function = initial_value->IsSharedFunctionInfo(); 146 bool is_function = initial_value->IsSharedFunctionInfo();
148 DCHECK_EQ(1, BoolToInt(is_var) + BoolToInt(is_function)); 147 DCHECK_EQ(1, BoolToInt(is_var) + BoolToInt(is_function));
149 148
150 Handle<Object> value; 149 Handle<Object> value;
151 if (is_function) { 150 if (is_function) {
152 DCHECK(possibly_literal_slot->IsSmi());
153 // Copy the function and update its context. Use it as value. 151 // Copy the function and update its context. Use it as value.
154 Handle<SharedFunctionInfo> shared = 152 Handle<SharedFunctionInfo> shared =
155 Handle<SharedFunctionInfo>::cast(initial_value); 153 Handle<SharedFunctionInfo>::cast(initial_value);
156 FeedbackVectorSlot literals_slot(
157 Smi::cast(*possibly_literal_slot)->value());
158 Handle<LiteralsArray> literals(
159 LiteralsArray::cast(feedback_vector->Get(literals_slot)), isolate);
160 Handle<JSFunction> function = 154 Handle<JSFunction> function =
161 isolate->factory()->NewFunctionFromSharedFunctionInfo( 155 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context,
162 shared, context, literals, TENURED); 156 TENURED);
163 value = function; 157 value = function;
164 } else { 158 } else {
165 value = isolate->factory()->undefined_value(); 159 value = isolate->factory()->undefined_value();
166 } 160 }
167 161
168 // Compute the property attributes. According to ECMA-262, 162 // Compute the property attributes. According to ECMA-262,
169 // the property must be non-configurable except in eval. 163 // the property must be non-configurable except in eval.
170 bool is_native = DeclareGlobalsNativeFlag::decode(flags); 164 bool is_native = DeclareGlobalsNativeFlag::decode(flags);
171 bool is_eval = DeclareGlobalsEvalFlag::decode(flags); 165 bool is_eval = DeclareGlobalsEvalFlag::decode(flags);
172 int attr = NONE; 166 int attr = NONE;
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { 989 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) {
996 HandleScope scope(isolate); 990 HandleScope scope(isolate);
997 DCHECK_EQ(2, args.length()); 991 DCHECK_EQ(2, args.length());
998 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); 992 CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
999 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); 993 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
1000 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); 994 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT));
1001 } 995 }
1002 996
1003 } // namespace internal 997 } // namespace internal
1004 } // namespace v8 998 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698