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

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

Issue 1135493006: Revert of [strong] Object literals create strong objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/runtime/runtime.h ('k') | test/mjsunit/strong/literals.js » ('j') | 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/parser.h" 10 #include "src/parser.h"
11 #include "src/runtime/runtime.h" 11 #include "src/runtime/runtime.h"
12 #include "src/runtime/runtime-utils.h" 12 #include "src/runtime/runtime-utils.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 16
17 static Handle<Map> ComputeObjectLiteralMap( 17 static Handle<Map> ComputeObjectLiteralMap(
18 Handle<Context> context, Handle<FixedArray> constant_properties, 18 Handle<Context> context, Handle<FixedArray> constant_properties,
19 bool is_strong, bool* is_result_from_cache) { 19 bool* is_result_from_cache) {
20 int properties_length = constant_properties->length(); 20 int properties_length = constant_properties->length();
21 int number_of_properties = properties_length / 2; 21 int number_of_properties = properties_length / 2;
22 22
23 for (int p = 0; p != properties_length; p += 2) { 23 for (int p = 0; p != properties_length; p += 2) {
24 Object* key = constant_properties->get(p); 24 Object* key = constant_properties->get(p);
25 uint32_t element_index = 0; 25 uint32_t element_index = 0;
26 if (key->ToArrayIndex(&element_index)) { 26 if (key->ToArrayIndex(&element_index)) {
27 // An index key does not require space in the property backing store. 27 // An index key does not require space in the property backing store.
28 number_of_properties--; 28 number_of_properties--;
29 } 29 }
30 } 30 }
31 Isolate* isolate = context->GetIsolate(); 31 Isolate* isolate = context->GetIsolate();
32 return isolate->factory()->ObjectLiteralMapFromCache( 32 return isolate->factory()->ObjectLiteralMapFromCache(
33 context, number_of_properties, is_strong, is_result_from_cache); 33 context, number_of_properties, is_result_from_cache);
34 } 34 }
35 35
36 MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate( 36 MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate(
37 Isolate* isolate, Handle<FixedArray> literals, 37 Isolate* isolate, Handle<FixedArray> literals,
38 Handle<FixedArray> constant_properties, bool is_strong); 38 Handle<FixedArray> constant_properties);
39 39
40 40
41 MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate( 41 MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
42 Isolate* isolate, Handle<FixedArray> literals, 42 Isolate* isolate, Handle<FixedArray> literals,
43 Handle<FixedArray> constant_properties, bool should_have_fast_elements, 43 Handle<FixedArray> constant_properties, bool should_have_fast_elements,
44 bool has_function_literal, bool is_strong) { 44 bool has_function_literal) {
45 Handle<Context> context = isolate->native_context(); 45 Handle<Context> context = isolate->native_context();
46 46
47 // In case we have function literals, we want the object to be in 47 // In case we have function literals, we want the object to be in
48 // slow properties mode for now. We don't go in the map cache because 48 // slow properties mode for now. We don't go in the map cache because
49 // maps with constant functions can't be shared if the functions are 49 // maps with constant functions can't be shared if the functions are
50 // not the same (which is the common case). 50 // not the same (which is the common case).
51 // TODO(rossberg): handle strong objects with function literals
52 bool is_result_from_cache = false; 51 bool is_result_from_cache = false;
53 Handle<Map> map = has_function_literal 52 Handle<Map> map = has_function_literal
54 ? Handle<Map>(context->object_function()->initial_map()) 53 ? Handle<Map>(context->object_function()->initial_map())
55 : ComputeObjectLiteralMap(context, constant_properties, 54 : ComputeObjectLiteralMap(context, constant_properties,
56 is_strong,
57 &is_result_from_cache); 55 &is_result_from_cache);
58 56
59 PretenureFlag pretenure_flag = 57 PretenureFlag pretenure_flag =
60 isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED; 58 isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED;
61 59
62 Handle<JSObject> boilerplate = 60 Handle<JSObject> boilerplate =
63 isolate->factory()->NewJSObjectFromMap(map, pretenure_flag); 61 isolate->factory()->NewJSObjectFromMap(map, pretenure_flag);
64 62
65 // Normalize the elements of the boilerplate to save space if needed. 63 // Normalize the elements of the boilerplate to save space if needed.
66 if (!should_have_fast_elements) JSObject::NormalizeElements(boilerplate); 64 if (!should_have_fast_elements) JSObject::NormalizeElements(boilerplate);
(...skipping 10 matching lines...) Expand all
77 } 75 }
78 // TODO(verwaest): Support tracking representations in the boilerplate. 76 // TODO(verwaest): Support tracking representations in the boilerplate.
79 for (int index = 0; index < length; index += 2) { 77 for (int index = 0; index < length; index += 2) {
80 Handle<Object> key(constant_properties->get(index + 0), isolate); 78 Handle<Object> key(constant_properties->get(index + 0), isolate);
81 Handle<Object> value(constant_properties->get(index + 1), isolate); 79 Handle<Object> value(constant_properties->get(index + 1), isolate);
82 if (value->IsFixedArray()) { 80 if (value->IsFixedArray()) {
83 // The value contains the constant_properties of a 81 // The value contains the constant_properties of a
84 // simple object or array literal. 82 // simple object or array literal.
85 Handle<FixedArray> array = Handle<FixedArray>::cast(value); 83 Handle<FixedArray> array = Handle<FixedArray>::cast(value);
86 ASSIGN_RETURN_ON_EXCEPTION( 84 ASSIGN_RETURN_ON_EXCEPTION(
87 isolate, value, 85 isolate, value, CreateLiteralBoilerplate(isolate, literals, array),
88 CreateLiteralBoilerplate(isolate, literals, array, is_strong),
89 Object); 86 Object);
90 } 87 }
91 MaybeHandle<Object> maybe_result; 88 MaybeHandle<Object> maybe_result;
92 uint32_t element_index = 0; 89 uint32_t element_index = 0;
93 if (key->IsInternalizedString()) { 90 if (key->IsInternalizedString()) {
94 if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) { 91 if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) {
95 // Array index as string (uint32). 92 // Array index as string (uint32).
96 if (value->IsUninitialized()) value = handle(Smi::FromInt(0), isolate); 93 if (value->IsUninitialized()) value = handle(Smi::FromInt(0), isolate);
97 maybe_result = 94 maybe_result =
98 JSObject::SetOwnElement(boilerplate, element_index, value, SLOPPY); 95 JSObject::SetOwnElement(boilerplate, element_index, value, SLOPPY);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 JSObject::MigrateSlowToFast(boilerplate, 130 JSObject::MigrateSlowToFast(boilerplate,
134 boilerplate->map()->unused_property_fields(), 131 boilerplate->map()->unused_property_fields(),
135 "FastLiteral"); 132 "FastLiteral");
136 } 133 }
137 return boilerplate; 134 return boilerplate;
138 } 135 }
139 136
140 137
141 MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate( 138 MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate(
142 Isolate* isolate, Handle<FixedArray> literals, 139 Isolate* isolate, Handle<FixedArray> literals,
143 Handle<FixedArray> elements, bool is_strong) { 140 Handle<FixedArray> elements) {
144 // Create the JSArray. 141 // Create the JSArray.
145 Handle<JSFunction> constructor = isolate->array_function(); 142 Handle<JSFunction> constructor = isolate->array_function();
146 143
147 PretenureFlag pretenure_flag = 144 PretenureFlag pretenure_flag =
148 isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED; 145 isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED;
149 146
150 Handle<JSArray> object = Handle<JSArray>::cast( 147 Handle<JSArray> object = Handle<JSArray>::cast(
151 isolate->factory()->NewJSObject(constructor, pretenure_flag)); 148 isolate->factory()->NewJSObject(constructor, pretenure_flag));
152 149
153 ElementsKind constant_elements_kind = 150 ElementsKind constant_elements_kind =
154 static_cast<ElementsKind>(Smi::cast(elements->get(0))->value()); 151 static_cast<ElementsKind>(Smi::cast(elements->get(0))->value());
155 Handle<FixedArrayBase> constant_elements_values( 152 Handle<FixedArrayBase> constant_elements_values(
156 FixedArrayBase::cast(elements->get(1))); 153 FixedArrayBase::cast(elements->get(1)));
157 154
158 { 155 {
159 DisallowHeapAllocation no_gc; 156 DisallowHeapAllocation no_gc;
160 DCHECK(IsFastElementsKind(constant_elements_kind)); 157 DCHECK(IsFastElementsKind(constant_elements_kind));
161 Context* native_context = isolate->context()->native_context(); 158 Context* native_context = isolate->context()->native_context();
162 Object* maps_array = is_strong 159 Object* maps_array = native_context->js_array_maps();
163 ? native_context->js_array_strong_maps()
164 : native_context->js_array_maps();
165 DCHECK(!maps_array->IsUndefined()); 160 DCHECK(!maps_array->IsUndefined());
166 Object* map = FixedArray::cast(maps_array)->get(constant_elements_kind); 161 Object* map = FixedArray::cast(maps_array)->get(constant_elements_kind);
167 object->set_map(Map::cast(map)); 162 object->set_map(Map::cast(map));
168 } 163 }
169 164
170 Handle<FixedArrayBase> copied_elements_values; 165 Handle<FixedArrayBase> copied_elements_values;
171 if (IsFastDoubleElementsKind(constant_elements_kind)) { 166 if (IsFastDoubleElementsKind(constant_elements_kind)) {
172 copied_elements_values = isolate->factory()->CopyFixedDoubleArray( 167 copied_elements_values = isolate->factory()->CopyFixedDoubleArray(
173 Handle<FixedDoubleArray>::cast(constant_elements_values)); 168 Handle<FixedDoubleArray>::cast(constant_elements_values));
174 } else { 169 } else {
(...skipping 15 matching lines...) Expand all
190 Handle<FixedArray> fixed_array_values_copy = 185 Handle<FixedArray> fixed_array_values_copy =
191 isolate->factory()->CopyFixedArray(fixed_array_values); 186 isolate->factory()->CopyFixedArray(fixed_array_values);
192 copied_elements_values = fixed_array_values_copy; 187 copied_elements_values = fixed_array_values_copy;
193 for (int i = 0; i < fixed_array_values->length(); i++) { 188 for (int i = 0; i < fixed_array_values->length(); i++) {
194 if (fixed_array_values->get(i)->IsFixedArray()) { 189 if (fixed_array_values->get(i)->IsFixedArray()) {
195 // The value contains the constant_properties of a 190 // The value contains the constant_properties of a
196 // simple object or array literal. 191 // simple object or array literal.
197 Handle<FixedArray> fa(FixedArray::cast(fixed_array_values->get(i))); 192 Handle<FixedArray> fa(FixedArray::cast(fixed_array_values->get(i)));
198 Handle<Object> result; 193 Handle<Object> result;
199 ASSIGN_RETURN_ON_EXCEPTION( 194 ASSIGN_RETURN_ON_EXCEPTION(
200 isolate, result, 195 isolate, result, CreateLiteralBoilerplate(isolate, literals, fa),
201 CreateLiteralBoilerplate(isolate, literals, fa, is_strong),
202 Object); 196 Object);
203 fixed_array_values_copy->set(i, *result); 197 fixed_array_values_copy->set(i, *result);
204 } 198 }
205 } 199 }
206 } 200 }
207 } 201 }
208 object->set_elements(*copied_elements_values); 202 object->set_elements(*copied_elements_values);
209 object->set_length(Smi::FromInt(copied_elements_values->length())); 203 object->set_length(Smi::FromInt(copied_elements_values->length()));
210 204
211 JSObject::ValidateElements(object); 205 JSObject::ValidateElements(object);
212 return object; 206 return object;
213 } 207 }
214 208
215 209
216 MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate( 210 MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate(
217 Isolate* isolate, Handle<FixedArray> literals, Handle<FixedArray> array, 211 Isolate* isolate, Handle<FixedArray> literals, Handle<FixedArray> array) {
218 bool is_strong) {
219 Handle<FixedArray> elements = CompileTimeValue::GetElements(array); 212 Handle<FixedArray> elements = CompileTimeValue::GetElements(array);
220 const bool kHasNoFunctionLiteral = false; 213 const bool kHasNoFunctionLiteral = false;
221 switch (CompileTimeValue::GetLiteralType(array)) { 214 switch (CompileTimeValue::GetLiteralType(array)) {
222 case CompileTimeValue::OBJECT_LITERAL_FAST_ELEMENTS: 215 case CompileTimeValue::OBJECT_LITERAL_FAST_ELEMENTS:
223 return CreateObjectLiteralBoilerplate(isolate, literals, elements, true, 216 return CreateObjectLiteralBoilerplate(isolate, literals, elements, true,
224 kHasNoFunctionLiteral, is_strong); 217 kHasNoFunctionLiteral);
225 case CompileTimeValue::OBJECT_LITERAL_SLOW_ELEMENTS: 218 case CompileTimeValue::OBJECT_LITERAL_SLOW_ELEMENTS:
226 return CreateObjectLiteralBoilerplate(isolate, literals, elements, false, 219 return CreateObjectLiteralBoilerplate(isolate, literals, elements, false,
227 kHasNoFunctionLiteral, is_strong); 220 kHasNoFunctionLiteral);
228 case CompileTimeValue::ARRAY_LITERAL: 221 case CompileTimeValue::ARRAY_LITERAL:
229 return Runtime::CreateArrayLiteralBoilerplate(isolate, literals, 222 return Runtime::CreateArrayLiteralBoilerplate(isolate, literals,
230 elements, is_strong); 223 elements);
231 default: 224 default:
232 UNREACHABLE(); 225 UNREACHABLE();
233 return MaybeHandle<Object>(); 226 return MaybeHandle<Object>();
234 } 227 }
235 } 228 }
236 229
237 230
238 RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) { 231 RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) {
239 HandleScope scope(isolate); 232 HandleScope scope(isolate);
240 DCHECK(args.length() == 4); 233 DCHECK(args.length() == 4);
241 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 234 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
242 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 235 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
243 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); 236 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2);
244 CONVERT_SMI_ARG_CHECKED(flags, 3); 237 CONVERT_SMI_ARG_CHECKED(flags, 3);
245 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; 238 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0;
246 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; 239 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0;
247 bool enable_mementos = (flags & ObjectLiteral::kDisableMementos) == 0; 240 bool enable_mementos = (flags & ObjectLiteral::kDisableMementos) == 0;
248 bool is_strong = (flags & ObjectLiteral::kIsStrong) != 0;
249 241
250 RUNTIME_ASSERT(literals_index >= 0 && literals_index < literals->length()); 242 RUNTIME_ASSERT(literals_index >= 0 && literals_index < literals->length());
251 243
252 // Check if boilerplate exists. If not, create it first. 244 // Check if boilerplate exists. If not, create it first.
253 Handle<Object> literal_site(literals->get(literals_index), isolate); 245 Handle<Object> literal_site(literals->get(literals_index), isolate);
254 Handle<AllocationSite> site; 246 Handle<AllocationSite> site;
255 Handle<JSObject> boilerplate; 247 Handle<JSObject> boilerplate;
256 if (*literal_site == isolate->heap()->undefined_value()) { 248 if (*literal_site == isolate->heap()->undefined_value()) {
257 Handle<Object> raw_boilerplate; 249 Handle<Object> raw_boilerplate;
258 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 250 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
259 isolate, raw_boilerplate, 251 isolate, raw_boilerplate,
260 CreateObjectLiteralBoilerplate(isolate, literals, constant_properties, 252 CreateObjectLiteralBoilerplate(isolate, literals, constant_properties,
261 should_have_fast_elements, 253 should_have_fast_elements,
262 has_function_literal, is_strong)); 254 has_function_literal));
263 boilerplate = Handle<JSObject>::cast(raw_boilerplate); 255 boilerplate = Handle<JSObject>::cast(raw_boilerplate);
264 256
265 AllocationSiteCreationContext creation_context(isolate); 257 AllocationSiteCreationContext creation_context(isolate);
266 site = creation_context.EnterNewScope(); 258 site = creation_context.EnterNewScope();
267 RETURN_FAILURE_ON_EXCEPTION( 259 RETURN_FAILURE_ON_EXCEPTION(
268 isolate, JSObject::DeepWalk(boilerplate, &creation_context)); 260 isolate, JSObject::DeepWalk(boilerplate, &creation_context));
269 creation_context.ExitScope(site, boilerplate); 261 creation_context.ExitScope(site, boilerplate);
270 262
271 // Update the functions literal and return the boilerplate. 263 // Update the functions literal and return the boilerplate.
272 literals->set(literals_index, *site); 264 literals->set(literals_index, *site);
273 } else { 265 } else {
274 site = Handle<AllocationSite>::cast(literal_site); 266 site = Handle<AllocationSite>::cast(literal_site);
275 boilerplate = 267 boilerplate =
276 Handle<JSObject>(JSObject::cast(site->transition_info()), isolate); 268 Handle<JSObject>(JSObject::cast(site->transition_info()), isolate);
277 } 269 }
278 270
279 AllocationSiteUsageContext usage_context(isolate, site, enable_mementos); 271 AllocationSiteUsageContext usage_context(isolate, site, enable_mementos);
280 usage_context.EnterNewScope(); 272 usage_context.EnterNewScope();
281 MaybeHandle<Object> maybe_copy = 273 MaybeHandle<Object> maybe_copy =
282 JSObject::DeepCopy(boilerplate, &usage_context); 274 JSObject::DeepCopy(boilerplate, &usage_context);
283 usage_context.ExitScope(site, boilerplate); 275 usage_context.ExitScope(site, boilerplate);
284 Handle<Object> copy; 276 Handle<Object> copy;
285 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, copy, maybe_copy); 277 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, copy, maybe_copy);
286 return *copy; 278 return *copy;
287 } 279 }
288 280
289 281
290 MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite( 282 MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite(
291 Isolate* isolate, Handle<FixedArray> literals, int literals_index, 283 Isolate* isolate, Handle<FixedArray> literals, int literals_index,
292 Handle<FixedArray> elements, bool is_strong) { 284 Handle<FixedArray> elements) {
293 // Check if boilerplate exists. If not, create it first. 285 // Check if boilerplate exists. If not, create it first.
294 Handle<Object> literal_site(literals->get(literals_index), isolate); 286 Handle<Object> literal_site(literals->get(literals_index), isolate);
295 Handle<AllocationSite> site; 287 Handle<AllocationSite> site;
296 if (*literal_site == isolate->heap()->undefined_value()) { 288 if (*literal_site == isolate->heap()->undefined_value()) {
297 DCHECK(*elements != isolate->heap()->empty_fixed_array()); 289 DCHECK(*elements != isolate->heap()->empty_fixed_array());
298 Handle<Object> boilerplate; 290 Handle<Object> boilerplate;
299 ASSIGN_RETURN_ON_EXCEPTION( 291 ASSIGN_RETURN_ON_EXCEPTION(
300 isolate, boilerplate, 292 isolate, boilerplate,
301 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements, 293 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements),
302 is_strong),
303 AllocationSite); 294 AllocationSite);
304 295
305 AllocationSiteCreationContext creation_context(isolate); 296 AllocationSiteCreationContext creation_context(isolate);
306 site = creation_context.EnterNewScope(); 297 site = creation_context.EnterNewScope();
307 if (JSObject::DeepWalk(Handle<JSObject>::cast(boilerplate), 298 if (JSObject::DeepWalk(Handle<JSObject>::cast(boilerplate),
308 &creation_context).is_null()) { 299 &creation_context).is_null()) {
309 return Handle<AllocationSite>::null(); 300 return Handle<AllocationSite>::null();
310 } 301 }
311 creation_context.ExitScope(site, Handle<JSObject>::cast(boilerplate)); 302 creation_context.ExitScope(site, Handle<JSObject>::cast(boilerplate));
312 303
313 literals->set(literals_index, *site); 304 literals->set(literals_index, *site);
314 } else { 305 } else {
315 site = Handle<AllocationSite>::cast(literal_site); 306 site = Handle<AllocationSite>::cast(literal_site);
316 } 307 }
317 308
318 return site; 309 return site;
319 } 310 }
320 311
321 312
322 static MaybeHandle<JSObject> CreateArrayLiteralImpl(Isolate* isolate, 313 static MaybeHandle<JSObject> CreateArrayLiteralImpl(Isolate* isolate,
323 Handle<FixedArray> literals, 314 Handle<FixedArray> literals,
324 int literals_index, 315 int literals_index,
325 Handle<FixedArray> elements, 316 Handle<FixedArray> elements,
326 int flags) { 317 int flags) {
327 RUNTIME_ASSERT_HANDLIFIED( 318 RUNTIME_ASSERT_HANDLIFIED(
328 literals_index >= 0 && literals_index < literals->length(), JSObject); 319 literals_index >= 0 && literals_index < literals->length(), JSObject);
329 Handle<AllocationSite> site; 320 Handle<AllocationSite> site;
330 bool is_strong = (flags & ArrayLiteral::kIsStrong) != 0;
331 ASSIGN_RETURN_ON_EXCEPTION( 321 ASSIGN_RETURN_ON_EXCEPTION(
332 isolate, site, 322 isolate, site,
333 GetLiteralAllocationSite(isolate, literals, literals_index, elements, 323 GetLiteralAllocationSite(isolate, literals, literals_index, elements),
334 is_strong),
335 JSObject); 324 JSObject);
336 325
337 bool enable_mementos = (flags & ArrayLiteral::kDisableMementos) == 0; 326 bool enable_mementos = (flags & ArrayLiteral::kDisableMementos) == 0;
338 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info())); 327 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info()));
339 AllocationSiteUsageContext usage_context(isolate, site, enable_mementos); 328 AllocationSiteUsageContext usage_context(isolate, site, enable_mementos);
340 usage_context.EnterNewScope(); 329 usage_context.EnterNewScope();
341 JSObject::DeepCopyHints hints = (flags & ArrayLiteral::kShallowElements) == 0 330 JSObject::DeepCopyHints hints = (flags & ArrayLiteral::kShallowElements) == 0
342 ? JSObject::kNoHints 331 ? JSObject::kNoHints
343 : JSObject::kObjectIsShallow; 332 : JSObject::kObjectIsShallow;
344 MaybeHandle<JSObject> copy = 333 MaybeHandle<JSObject> copy =
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind); 419 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind);
431 } 420 }
432 } 421 }
433 FixedArray* object_array = FixedArray::cast(object->elements()); 422 FixedArray* object_array = FixedArray::cast(object->elements());
434 object_array->set(store_index, *value); 423 object_array->set(store_index, *value);
435 } 424 }
436 return *object; 425 return *object;
437 } 426 }
438 } 427 }
439 } // namespace v8::internal 428 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/strong/literals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698