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

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

Issue 1156323004: Version 4.2.77.21 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.2
Patch Set: Created 5 years, 6 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/ppc/full-codegen-ppc.cc ('k') | src/x64/full-codegen-x64.cc » ('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"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(FixedArray, 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 249
249 RUNTIME_ASSERT(literals_index >= 0 && literals_index < literals->length()); 250 RUNTIME_ASSERT(literals_index >= 0 && literals_index < literals->length());
250 251
251 // Check if boilerplate exists. If not, create it first. 252 // Check if boilerplate exists. If not, create it first.
252 Handle<Object> literal_site(literals->get(literals_index), isolate); 253 Handle<Object> literal_site(literals->get(literals_index), isolate);
253 Handle<AllocationSite> site; 254 Handle<AllocationSite> site;
254 Handle<JSObject> boilerplate; 255 Handle<JSObject> boilerplate;
255 if (*literal_site == isolate->heap()->undefined_value()) { 256 if (*literal_site == isolate->heap()->undefined_value()) {
256 Handle<Object> raw_boilerplate; 257 Handle<Object> raw_boilerplate;
257 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 258 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
(...skipping 10 matching lines...) Expand all
268 creation_context.ExitScope(site, boilerplate); 269 creation_context.ExitScope(site, boilerplate);
269 270
270 // Update the functions literal and return the boilerplate. 271 // Update the functions literal and return the boilerplate.
271 literals->set(literals_index, *site); 272 literals->set(literals_index, *site);
272 } else { 273 } else {
273 site = Handle<AllocationSite>::cast(literal_site); 274 site = Handle<AllocationSite>::cast(literal_site);
274 boilerplate = 275 boilerplate =
275 Handle<JSObject>(JSObject::cast(site->transition_info()), isolate); 276 Handle<JSObject>(JSObject::cast(site->transition_info()), isolate);
276 } 277 }
277 278
278 AllocationSiteUsageContext usage_context(isolate, site, true); 279 AllocationSiteUsageContext usage_context(isolate, site, enable_mementos);
279 usage_context.EnterNewScope(); 280 usage_context.EnterNewScope();
280 MaybeHandle<Object> maybe_copy = 281 MaybeHandle<Object> maybe_copy =
281 JSObject::DeepCopy(boilerplate, &usage_context); 282 JSObject::DeepCopy(boilerplate, &usage_context);
282 usage_context.ExitScope(site, boilerplate); 283 usage_context.ExitScope(site, boilerplate);
283 Handle<Object> copy; 284 Handle<Object> copy;
284 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, copy, maybe_copy); 285 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, copy, maybe_copy);
285 return *copy; 286 return *copy;
286 } 287 }
287 288
288 289
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind); 427 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind);
427 } 428 }
428 } 429 }
429 FixedArray* object_array = FixedArray::cast(object->elements()); 430 FixedArray* object_array = FixedArray::cast(object->elements());
430 object_array->set(store_index, *value); 431 object_array->set(store_index, *value);
431 } 432 }
432 return *object; 433 return *object;
433 } 434 }
434 } 435 }
435 } // namespace v8::internal 436 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ppc/full-codegen-ppc.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698