| 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 "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/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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_strong, 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<LiteralsArray> literals, |
| 38 Handle<FixedArray> constant_properties, bool is_strong); | 38 Handle<FixedArray> constant_properties, bool is_strong); |
| 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<LiteralsArray> 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, bool is_strong) { |
| 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 bool is_result_from_cache = false; | 51 bool is_result_from_cache = false; |
| 52 Handle<Map> map = has_function_literal | 52 Handle<Map> map = has_function_literal |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (should_transform && !has_function_literal) { | 132 if (should_transform && !has_function_literal) { |
| 133 JSObject::MigrateSlowToFast(boilerplate, | 133 JSObject::MigrateSlowToFast(boilerplate, |
| 134 boilerplate->map()->unused_property_fields(), | 134 boilerplate->map()->unused_property_fields(), |
| 135 "FastLiteral"); | 135 "FastLiteral"); |
| 136 } | 136 } |
| 137 return boilerplate; | 137 return boilerplate; |
| 138 } | 138 } |
| 139 | 139 |
| 140 | 140 |
| 141 MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate( | 141 MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate( |
| 142 Isolate* isolate, Handle<FixedArray> literals, | 142 Isolate* isolate, Handle<LiteralsArray> literals, |
| 143 Handle<FixedArray> elements, bool is_strong) { | 143 Handle<FixedArray> elements, bool is_strong) { |
| 144 // Create the JSArray. | 144 // Create the JSArray. |
| 145 Handle<JSFunction> constructor = isolate->array_function(); | 145 Handle<JSFunction> constructor = isolate->array_function(); |
| 146 | 146 |
| 147 PretenureFlag pretenure_flag = | 147 PretenureFlag pretenure_flag = |
| 148 isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED; | 148 isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED; |
| 149 | 149 |
| 150 Handle<JSArray> object = Handle<JSArray>::cast( | 150 Handle<JSArray> object = Handle<JSArray>::cast( |
| 151 isolate->factory()->NewJSObject(constructor, pretenure_flag)); | 151 isolate->factory()->NewJSObject(constructor, pretenure_flag)); |
| 152 | 152 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 object->set_elements(*copied_elements_values); | 209 object->set_elements(*copied_elements_values); |
| 210 object->set_length(Smi::FromInt(copied_elements_values->length())); | 210 object->set_length(Smi::FromInt(copied_elements_values->length())); |
| 211 | 211 |
| 212 JSObject::ValidateElements(object); | 212 JSObject::ValidateElements(object); |
| 213 return object; | 213 return object; |
| 214 } | 214 } |
| 215 | 215 |
| 216 | 216 |
| 217 MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate( | 217 MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate( |
| 218 Isolate* isolate, Handle<FixedArray> literals, Handle<FixedArray> array, | 218 Isolate* isolate, Handle<LiteralsArray> literals, Handle<FixedArray> array, |
| 219 bool is_strong) { | 219 bool is_strong) { |
| 220 Handle<FixedArray> elements = CompileTimeValue::GetElements(array); | 220 Handle<FixedArray> elements = CompileTimeValue::GetElements(array); |
| 221 const bool kHasNoFunctionLiteral = false; | 221 const bool kHasNoFunctionLiteral = false; |
| 222 switch (CompileTimeValue::GetLiteralType(array)) { | 222 switch (CompileTimeValue::GetLiteralType(array)) { |
| 223 case CompileTimeValue::OBJECT_LITERAL_FAST_ELEMENTS: | 223 case CompileTimeValue::OBJECT_LITERAL_FAST_ELEMENTS: |
| 224 return CreateObjectLiteralBoilerplate(isolate, literals, elements, true, | 224 return CreateObjectLiteralBoilerplate(isolate, literals, elements, true, |
| 225 kHasNoFunctionLiteral, is_strong); | 225 kHasNoFunctionLiteral, is_strong); |
| 226 case CompileTimeValue::OBJECT_LITERAL_SLOW_ELEMENTS: | 226 case CompileTimeValue::OBJECT_LITERAL_SLOW_ELEMENTS: |
| 227 return CreateObjectLiteralBoilerplate(isolate, literals, elements, false, | 227 return CreateObjectLiteralBoilerplate(isolate, literals, elements, false, |
| 228 kHasNoFunctionLiteral, is_strong); | 228 kHasNoFunctionLiteral, is_strong); |
| 229 case CompileTimeValue::ARRAY_LITERAL: | 229 case CompileTimeValue::ARRAY_LITERAL: |
| 230 return Runtime::CreateArrayLiteralBoilerplate(isolate, literals, | 230 return Runtime::CreateArrayLiteralBoilerplate(isolate, literals, |
| 231 elements, is_strong); | 231 elements, is_strong); |
| 232 default: | 232 default: |
| 233 UNREACHABLE(); | 233 UNREACHABLE(); |
| 234 return MaybeHandle<Object>(); | 234 return MaybeHandle<Object>(); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 | 238 |
| 239 RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) { | 239 RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) { |
| 240 HandleScope scope(isolate); | 240 HandleScope scope(isolate); |
| 241 DCHECK(args.length() == 4); | 241 DCHECK(args.length() == 4); |
| 242 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 242 CONVERT_ARG_HANDLE_CHECKED(LiteralsArray, literals, 0); |
| 243 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 243 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
| 244 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); | 244 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); |
| 245 CONVERT_SMI_ARG_CHECKED(flags, 3); | 245 CONVERT_SMI_ARG_CHECKED(flags, 3); |
| 246 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; | 246 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; |
| 247 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; | 247 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; |
| 248 bool enable_mementos = (flags & ObjectLiteral::kDisableMementos) == 0; | 248 bool enable_mementos = (flags & ObjectLiteral::kDisableMementos) == 0; |
| 249 bool is_strong = (flags & ObjectLiteral::kIsStrong) != 0; | 249 bool is_strong = (flags & ObjectLiteral::kIsStrong) != 0; |
| 250 | 250 |
| 251 RUNTIME_ASSERT(literals_index >= 0 && literals_index < literals->length()); | 251 RUNTIME_ASSERT(literals_index >= 0 && |
| 252 literals_index < literals->literals_count()); |
| 252 | 253 |
| 253 // Check if boilerplate exists. If not, create it first. | 254 // Check if boilerplate exists. If not, create it first. |
| 254 Handle<Object> literal_site(literals->get(literals_index), isolate); | 255 Handle<Object> literal_site(literals->literal(literals_index), isolate); |
| 255 Handle<AllocationSite> site; | 256 Handle<AllocationSite> site; |
| 256 Handle<JSObject> boilerplate; | 257 Handle<JSObject> boilerplate; |
| 257 if (*literal_site == isolate->heap()->undefined_value()) { | 258 if (*literal_site == isolate->heap()->undefined_value()) { |
| 258 Handle<Object> raw_boilerplate; | 259 Handle<Object> raw_boilerplate; |
| 259 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 260 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 260 isolate, raw_boilerplate, | 261 isolate, raw_boilerplate, |
| 261 CreateObjectLiteralBoilerplate(isolate, literals, constant_properties, | 262 CreateObjectLiteralBoilerplate(isolate, literals, constant_properties, |
| 262 should_have_fast_elements, | 263 should_have_fast_elements, |
| 263 has_function_literal, is_strong)); | 264 has_function_literal, is_strong)); |
| 264 boilerplate = Handle<JSObject>::cast(raw_boilerplate); | 265 boilerplate = Handle<JSObject>::cast(raw_boilerplate); |
| 265 | 266 |
| 266 AllocationSiteCreationContext creation_context(isolate); | 267 AllocationSiteCreationContext creation_context(isolate); |
| 267 site = creation_context.EnterNewScope(); | 268 site = creation_context.EnterNewScope(); |
| 268 RETURN_FAILURE_ON_EXCEPTION( | 269 RETURN_FAILURE_ON_EXCEPTION( |
| 269 isolate, JSObject::DeepWalk(boilerplate, &creation_context)); | 270 isolate, JSObject::DeepWalk(boilerplate, &creation_context)); |
| 270 creation_context.ExitScope(site, boilerplate); | 271 creation_context.ExitScope(site, boilerplate); |
| 271 | 272 |
| 272 // Update the functions literal and return the boilerplate. | 273 // Update the functions literal and return the boilerplate. |
| 273 literals->set(literals_index, *site); | 274 literals->set_literal(literals_index, *site); |
| 274 } else { | 275 } else { |
| 275 site = Handle<AllocationSite>::cast(literal_site); | 276 site = Handle<AllocationSite>::cast(literal_site); |
| 276 boilerplate = | 277 boilerplate = |
| 277 Handle<JSObject>(JSObject::cast(site->transition_info()), isolate); | 278 Handle<JSObject>(JSObject::cast(site->transition_info()), isolate); |
| 278 } | 279 } |
| 279 | 280 |
| 280 AllocationSiteUsageContext usage_context(isolate, site, enable_mementos); | 281 AllocationSiteUsageContext usage_context(isolate, site, enable_mementos); |
| 281 usage_context.EnterNewScope(); | 282 usage_context.EnterNewScope(); |
| 282 MaybeHandle<Object> maybe_copy = | 283 MaybeHandle<Object> maybe_copy = |
| 283 JSObject::DeepCopy(boilerplate, &usage_context); | 284 JSObject::DeepCopy(boilerplate, &usage_context); |
| 284 usage_context.ExitScope(site, boilerplate); | 285 usage_context.ExitScope(site, boilerplate); |
| 285 Handle<Object> copy; | 286 Handle<Object> copy; |
| 286 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, copy, maybe_copy); | 287 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, copy, maybe_copy); |
| 287 return *copy; | 288 return *copy; |
| 288 } | 289 } |
| 289 | 290 |
| 290 | 291 |
| 291 MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite( | 292 MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite( |
| 292 Isolate* isolate, Handle<FixedArray> literals, int literals_index, | 293 Isolate* isolate, Handle<LiteralsArray> literals, int literals_index, |
| 293 Handle<FixedArray> elements, bool is_strong) { | 294 Handle<FixedArray> elements, bool is_strong) { |
| 294 // Check if boilerplate exists. If not, create it first. | 295 // Check if boilerplate exists. If not, create it first. |
| 295 Handle<Object> literal_site(literals->get(literals_index), isolate); | 296 Handle<Object> literal_site(literals->literal(literals_index), isolate); |
| 296 Handle<AllocationSite> site; | 297 Handle<AllocationSite> site; |
| 297 if (*literal_site == isolate->heap()->undefined_value()) { | 298 if (*literal_site == isolate->heap()->undefined_value()) { |
| 298 DCHECK(*elements != isolate->heap()->empty_fixed_array()); | 299 DCHECK(*elements != isolate->heap()->empty_fixed_array()); |
| 299 Handle<Object> boilerplate; | 300 Handle<Object> boilerplate; |
| 300 ASSIGN_RETURN_ON_EXCEPTION( | 301 ASSIGN_RETURN_ON_EXCEPTION( |
| 301 isolate, boilerplate, | 302 isolate, boilerplate, |
| 302 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements, | 303 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements, |
| 303 is_strong), | 304 is_strong), |
| 304 AllocationSite); | 305 AllocationSite); |
| 305 | 306 |
| 306 AllocationSiteCreationContext creation_context(isolate); | 307 AllocationSiteCreationContext creation_context(isolate); |
| 307 site = creation_context.EnterNewScope(); | 308 site = creation_context.EnterNewScope(); |
| 308 if (JSObject::DeepWalk(Handle<JSObject>::cast(boilerplate), | 309 if (JSObject::DeepWalk(Handle<JSObject>::cast(boilerplate), |
| 309 &creation_context).is_null()) { | 310 &creation_context).is_null()) { |
| 310 return Handle<AllocationSite>::null(); | 311 return Handle<AllocationSite>::null(); |
| 311 } | 312 } |
| 312 creation_context.ExitScope(site, Handle<JSObject>::cast(boilerplate)); | 313 creation_context.ExitScope(site, Handle<JSObject>::cast(boilerplate)); |
| 313 | 314 |
| 314 literals->set(literals_index, *site); | 315 literals->set_literal(literals_index, *site); |
| 315 } else { | 316 } else { |
| 316 site = Handle<AllocationSite>::cast(literal_site); | 317 site = Handle<AllocationSite>::cast(literal_site); |
| 317 } | 318 } |
| 318 | 319 |
| 319 return site; | 320 return site; |
| 320 } | 321 } |
| 321 | 322 |
| 322 | 323 |
| 323 static MaybeHandle<JSObject> CreateArrayLiteralImpl(Isolate* isolate, | 324 static MaybeHandle<JSObject> CreateArrayLiteralImpl( |
| 324 Handle<FixedArray> literals, | 325 Isolate* isolate, Handle<LiteralsArray> literals, int literals_index, |
| 325 int literals_index, | 326 Handle<FixedArray> elements, int flags) { |
| 326 Handle<FixedArray> elements, | |
| 327 int flags) { | |
| 328 RUNTIME_ASSERT_HANDLIFIED( | 327 RUNTIME_ASSERT_HANDLIFIED( |
| 329 literals_index >= 0 && literals_index < literals->length(), JSObject); | 328 literals_index >= 0 && literals_index < literals->literals_count(), |
| 329 JSObject); |
| 330 Handle<AllocationSite> site; | 330 Handle<AllocationSite> site; |
| 331 bool is_strong = (flags & ArrayLiteral::kIsStrong) != 0; | 331 bool is_strong = (flags & ArrayLiteral::kIsStrong) != 0; |
| 332 ASSIGN_RETURN_ON_EXCEPTION( | 332 ASSIGN_RETURN_ON_EXCEPTION( |
| 333 isolate, site, | 333 isolate, site, |
| 334 GetLiteralAllocationSite(isolate, literals, literals_index, elements, | 334 GetLiteralAllocationSite(isolate, literals, literals_index, elements, |
| 335 is_strong), | 335 is_strong), |
| 336 JSObject); | 336 JSObject); |
| 337 | 337 |
| 338 bool enable_mementos = (flags & ArrayLiteral::kDisableMementos) == 0; | 338 bool enable_mementos = (flags & ArrayLiteral::kDisableMementos) == 0; |
| 339 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info())); | 339 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info())); |
| 340 AllocationSiteUsageContext usage_context(isolate, site, enable_mementos); | 340 AllocationSiteUsageContext usage_context(isolate, site, enable_mementos); |
| 341 usage_context.EnterNewScope(); | 341 usage_context.EnterNewScope(); |
| 342 JSObject::DeepCopyHints hints = (flags & ArrayLiteral::kShallowElements) == 0 | 342 JSObject::DeepCopyHints hints = (flags & ArrayLiteral::kShallowElements) == 0 |
| 343 ? JSObject::kNoHints | 343 ? JSObject::kNoHints |
| 344 : JSObject::kObjectIsShallow; | 344 : JSObject::kObjectIsShallow; |
| 345 MaybeHandle<JSObject> copy = | 345 MaybeHandle<JSObject> copy = |
| 346 JSObject::DeepCopy(boilerplate, &usage_context, hints); | 346 JSObject::DeepCopy(boilerplate, &usage_context, hints); |
| 347 usage_context.ExitScope(site, boilerplate); | 347 usage_context.ExitScope(site, boilerplate); |
| 348 return copy; | 348 return copy; |
| 349 } | 349 } |
| 350 | 350 |
| 351 | 351 |
| 352 RUNTIME_FUNCTION(Runtime_CreateArrayLiteral) { | 352 RUNTIME_FUNCTION(Runtime_CreateArrayLiteral) { |
| 353 HandleScope scope(isolate); | 353 HandleScope scope(isolate); |
| 354 DCHECK(args.length() == 4); | 354 DCHECK(args.length() == 4); |
| 355 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 355 CONVERT_ARG_HANDLE_CHECKED(LiteralsArray, literals, 0); |
| 356 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 356 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
| 357 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 357 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
| 358 CONVERT_SMI_ARG_CHECKED(flags, 3); | 358 CONVERT_SMI_ARG_CHECKED(flags, 3); |
| 359 | 359 |
| 360 Handle<JSObject> result; | 360 Handle<JSObject> result; |
| 361 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 361 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 362 isolate, result, CreateArrayLiteralImpl(isolate, literals, literals_index, | 362 isolate, result, CreateArrayLiteralImpl(isolate, literals, literals_index, |
| 363 elements, flags)); | 363 elements, flags)); |
| 364 return *result; | 364 return *result; |
| 365 } | 365 } |
| 366 | 366 |
| 367 | 367 |
| 368 RUNTIME_FUNCTION(Runtime_CreateArrayLiteralStubBailout) { | 368 RUNTIME_FUNCTION(Runtime_CreateArrayLiteralStubBailout) { |
| 369 HandleScope scope(isolate); | 369 HandleScope scope(isolate); |
| 370 DCHECK(args.length() == 3); | 370 DCHECK(args.length() == 3); |
| 371 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 371 CONVERT_ARG_HANDLE_CHECKED(LiteralsArray, literals, 0); |
| 372 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 372 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
| 373 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 373 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
| 374 | 374 |
| 375 Handle<JSObject> result; | 375 Handle<JSObject> result; |
| 376 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 376 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 377 isolate, result, | 377 isolate, result, |
| 378 CreateArrayLiteralImpl(isolate, literals, literals_index, elements, | 378 CreateArrayLiteralImpl(isolate, literals, literals_index, elements, |
| 379 ArrayLiteral::kShallowElements)); | 379 ArrayLiteral::kShallowElements)); |
| 380 return *result; | 380 return *result; |
| 381 } | 381 } |
| 382 | 382 |
| 383 | 383 |
| 384 RUNTIME_FUNCTION(Runtime_StoreArrayLiteralElement) { | 384 RUNTIME_FUNCTION(Runtime_StoreArrayLiteralElement) { |
| 385 HandleScope scope(isolate); | 385 HandleScope scope(isolate); |
| 386 RUNTIME_ASSERT(args.length() == 5); | 386 RUNTIME_ASSERT(args.length() == 5); |
| 387 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 387 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
| 388 CONVERT_SMI_ARG_CHECKED(store_index, 1); | 388 CONVERT_SMI_ARG_CHECKED(store_index, 1); |
| 389 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | 389 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
| 390 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3); | 390 CONVERT_ARG_HANDLE_CHECKED(LiteralsArray, literals, 3); |
| 391 CONVERT_SMI_ARG_CHECKED(literal_index, 4); | 391 CONVERT_SMI_ARG_CHECKED(literal_index, 4); |
| 392 | 392 |
| 393 Object* raw_literal_cell = literals->get(literal_index); | 393 Object* raw_literal_cell = literals->literal(literal_index); |
| 394 JSArray* boilerplate = NULL; | 394 JSArray* boilerplate = NULL; |
| 395 if (raw_literal_cell->IsAllocationSite()) { | 395 if (raw_literal_cell->IsAllocationSite()) { |
| 396 AllocationSite* site = AllocationSite::cast(raw_literal_cell); | 396 AllocationSite* site = AllocationSite::cast(raw_literal_cell); |
| 397 boilerplate = JSArray::cast(site->transition_info()); | 397 boilerplate = JSArray::cast(site->transition_info()); |
| 398 } else { | 398 } else { |
| 399 boilerplate = JSArray::cast(raw_literal_cell); | 399 boilerplate = JSArray::cast(raw_literal_cell); |
| 400 } | 400 } |
| 401 Handle<JSArray> boilerplate_object(boilerplate); | 401 Handle<JSArray> boilerplate_object(boilerplate); |
| 402 ElementsKind elements_kind = object->GetElementsKind(); | 402 ElementsKind elements_kind = object->GetElementsKind(); |
| 403 DCHECK(IsFastElementsKind(elements_kind)); | 403 DCHECK(IsFastElementsKind(elements_kind)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 429 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind); | 429 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind); |
| 430 } | 430 } |
| 431 } | 431 } |
| 432 FixedArray* object_array = FixedArray::cast(object->elements()); | 432 FixedArray* object_array = FixedArray::cast(object->elements()); |
| 433 object_array->set(store_index, *value); | 433 object_array->set(store_index, *value); |
| 434 } | 434 } |
| 435 return *object; | 435 return *object; |
| 436 } | 436 } |
| 437 } // namespace internal | 437 } // namespace internal |
| 438 } // namespace v8 | 438 } // namespace v8 |
| OLD | NEW |