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

Side by Side Diff: src/runtime.cc

Issue 26827002: Allow FastCloneShallowObjectStub to use AllocationMementos. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More comments Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 HandleScope scope(isolate); 479 HandleScope scope(isolate);
480 ASSERT(args.length() == 4); 480 ASSERT(args.length() == 4);
481 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 481 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
482 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 482 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
483 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); 483 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2);
484 CONVERT_SMI_ARG_CHECKED(flags, 3); 484 CONVERT_SMI_ARG_CHECKED(flags, 3);
485 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; 485 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0;
486 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; 486 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0;
487 487
488 // Check if boilerplate exists. If not, create it first. 488 // Check if boilerplate exists. If not, create it first.
489 Handle<Object> boilerplate(literals->get(literals_index), isolate); 489 Handle<Object> literal_site(literals->get(literals_index), isolate);
490 if (*boilerplate == isolate->heap()->undefined_value()) { 490 Handle<AllocationSite> site;
491 Handle<Object> boilerplate;
492 if (*literal_site == isolate->heap()->undefined_value()) {
491 boilerplate = CreateObjectLiteralBoilerplate(isolate, 493 boilerplate = CreateObjectLiteralBoilerplate(isolate,
492 literals, 494 literals,
493 constant_properties, 495 constant_properties,
494 should_have_fast_elements, 496 should_have_fast_elements,
495 has_function_literal); 497 has_function_literal);
496 RETURN_IF_EMPTY_HANDLE(isolate, boilerplate); 498 RETURN_IF_EMPTY_HANDLE(isolate, boilerplate);
499 site = isolate->factory()->NewAllocationSite();
500 site->set_transition_info(*boilerplate);
501
497 // Update the functions literal and return the boilerplate. 502 // Update the functions literal and return the boilerplate.
498 literals->set(literals_index, *boilerplate); 503 literals->set(literals_index, *site);
504 } else {
505 site = Handle<AllocationSite>::cast(literal_site);
506 boilerplate = Handle<JSObject>(JSObject::cast(site->transition_info()));
499 } 507 }
500 508
501 Handle<Object> copy = JSObject::DeepCopy(Handle<JSObject>::cast(boilerplate)); 509 Handle<Object> copy = JSObject::DeepCopy(Handle<JSObject>::cast(boilerplate));
502 RETURN_IF_EMPTY_HANDLE(isolate, copy); 510 RETURN_IF_EMPTY_HANDLE(isolate, copy);
503 return *copy; 511 return *copy;
504 } 512 }
505 513
506 514
507 static Handle<AllocationSite> GetLiteralAllocationSite( 515 static Handle<AllocationSite> GetLiteralAllocationSite(
508 Isolate* isolate, 516 Isolate* isolate,
(...skipping 14307 matching lines...) Expand 10 before | Expand all | Expand 10 after
14816 // Handle last resort GC and make sure to allow future allocations 14824 // Handle last resort GC and make sure to allow future allocations
14817 // to grow the heap without causing GCs (if possible). 14825 // to grow the heap without causing GCs (if possible).
14818 isolate->counters()->gc_last_resort_from_js()->Increment(); 14826 isolate->counters()->gc_last_resort_from_js()->Increment();
14819 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14827 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14820 "Runtime::PerformGC"); 14828 "Runtime::PerformGC");
14821 } 14829 }
14822 } 14830 }
14823 14831
14824 14832
14825 } } // namespace v8::internal 14833 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698