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

Side by Side Diff: src/runtime.cc

Issue 22934006: Handlify JSObject::DeepCopy method. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Toon Verwaest. Created 7 years, 3 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/objects.cc ('k') | test/cctest/test-heap.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 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 if (*boilerplate == isolate->heap()->undefined_value()) { 493 if (*boilerplate == isolate->heap()->undefined_value()) {
494 boilerplate = CreateObjectLiteralBoilerplate(isolate, 494 boilerplate = CreateObjectLiteralBoilerplate(isolate,
495 literals, 495 literals,
496 constant_properties, 496 constant_properties,
497 should_have_fast_elements, 497 should_have_fast_elements,
498 has_function_literal); 498 has_function_literal);
499 RETURN_IF_EMPTY_HANDLE(isolate, boilerplate); 499 RETURN_IF_EMPTY_HANDLE(isolate, boilerplate);
500 // Update the functions literal and return the boilerplate. 500 // Update the functions literal and return the boilerplate.
501 literals->set(literals_index, *boilerplate); 501 literals->set(literals_index, *boilerplate);
502 } 502 }
503 return JSObject::cast(*boilerplate)->DeepCopy(isolate); 503
504 Handle<Object> copy = JSObject::DeepCopy(Handle<JSObject>::cast(boilerplate));
505 RETURN_IF_EMPTY_HANDLE(isolate, copy);
506 return *copy;
504 } 507 }
505 508
506 509
507 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) { 510 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) {
508 HandleScope scope(isolate); 511 HandleScope scope(isolate);
509 ASSERT(args.length() == 4); 512 ASSERT(args.length() == 4);
510 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 513 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
511 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 514 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
512 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); 515 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2);
513 CONVERT_SMI_ARG_CHECKED(flags, 3); 516 CONVERT_SMI_ARG_CHECKED(flags, 3);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 HandleScope scope(isolate); 561 HandleScope scope(isolate);
559 ASSERT(args.length() == 3); 562 ASSERT(args.length() == 3);
560 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 563 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
561 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 564 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
562 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); 565 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
563 566
564 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals, 567 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals,
565 literals_index, elements); 568 literals_index, elements);
566 RETURN_IF_EMPTY_HANDLE(isolate, site); 569 RETURN_IF_EMPTY_HANDLE(isolate, site);
567 570
568 JSObject* boilerplate = JSObject::cast(site->transition_info()); 571 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info()));
569 return boilerplate->DeepCopy(isolate); 572 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate);
573 RETURN_IF_EMPTY_HANDLE(isolate, copy);
574 return *copy;
570 } 575 }
571 576
572 577
573 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { 578 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) {
574 HandleScope scope(isolate); 579 HandleScope scope(isolate);
575 ASSERT(args.length() == 3); 580 ASSERT(args.length() == 3);
576 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 581 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
577 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 582 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
578 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); 583 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
579 584
(...skipping 13901 matching lines...) Expand 10 before | Expand all | Expand 10 after
14481 // Handle last resort GC and make sure to allow future allocations 14486 // Handle last resort GC and make sure to allow future allocations
14482 // to grow the heap without causing GCs (if possible). 14487 // to grow the heap without causing GCs (if possible).
14483 isolate->counters()->gc_last_resort_from_js()->Increment(); 14488 isolate->counters()->gc_last_resort_from_js()->Increment();
14484 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14489 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14485 "Runtime::PerformGC"); 14490 "Runtime::PerformGC");
14486 } 14491 }
14487 } 14492 }
14488 14493
14489 14494
14490 } } // namespace v8::internal 14495 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698