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

Side by Side Diff: src/runtime.cc

Issue 54333003: Remove CreateArrayLiteralShallow (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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
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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 ASSERT(args.length() == 3); 559 ASSERT(args.length() == 3);
560 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 560 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
561 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 561 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
562 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); 562 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
563 563
564 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals, 564 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals,
565 literals_index, elements); 565 literals_index, elements);
566 RETURN_IF_EMPTY_HANDLE(isolate, site); 566 RETURN_IF_EMPTY_HANDLE(isolate, site);
567 567
568 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info())); 568 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info()));
569 if (boilerplate->elements()->map() ==
570 isolate->heap()->fixed_cow_array_map()) {
571 isolate->counters()->cow_arrays_created_runtime()->Increment();
Michael Starzinger 2013/11/04 14:12:03 See comments in objects.cc about this.
mvstanton 2013/11/04 14:47:15 Right on, removed this code.
572 }
573
569 AllocationSiteUsageContext usage_context(isolate, site, true); 574 AllocationSiteUsageContext usage_context(isolate, site, true);
570 usage_context.EnterNewScope(); 575 usage_context.EnterNewScope();
571 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context); 576 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context);
572 usage_context.ExitScope(site, boilerplate); 577 usage_context.ExitScope(site, boilerplate);
573 RETURN_IF_EMPTY_HANDLE(isolate, copy); 578 RETURN_IF_EMPTY_HANDLE(isolate, copy);
574 return *copy; 579 return *copy;
575 } 580 }
576 581
577 582
578 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) {
579 HandleScope scope(isolate);
580 ASSERT(args.length() == 3);
581 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
582 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
583 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
584
585 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals,
586 literals_index, elements);
587 RETURN_IF_EMPTY_HANDLE(isolate, site);
588
589 JSObject* boilerplate = JSObject::cast(site->transition_info());
590 if (boilerplate->elements()->map() ==
591 isolate->heap()->fixed_cow_array_map()) {
592 isolate->counters()->cow_arrays_created_runtime()->Increment();
593 }
594
595 if (AllocationSite::GetMode(boilerplate->GetElementsKind()) ==
596 TRACK_ALLOCATION_SITE) {
597 return isolate->heap()->CopyJSObject(boilerplate, *site);
598 }
599
600 return isolate->heap()->CopyJSObject(boilerplate);
601 }
602
603
604 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { 583 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) {
605 HandleScope scope(isolate); 584 HandleScope scope(isolate);
606 ASSERT(args.length() == 1); 585 ASSERT(args.length() == 1);
607 Handle<Object> name(args[0], isolate); 586 Handle<Object> name(args[0], isolate);
608 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); 587 RUNTIME_ASSERT(name->IsString() || name->IsUndefined());
609 Symbol* symbol; 588 Symbol* symbol;
610 MaybeObject* maybe = isolate->heap()->AllocateSymbol(); 589 MaybeObject* maybe = isolate->heap()->AllocateSymbol();
611 if (!maybe->To(&symbol)) return maybe; 590 if (!maybe->To(&symbol)) return maybe;
612 if (name->IsString()) symbol->set_name(*name); 591 if (name->IsString()) symbol->set_name(*name);
613 return symbol; 592 return symbol;
(...skipping 14252 matching lines...) Expand 10 before | Expand all | Expand 10 after
14866 // Handle last resort GC and make sure to allow future allocations 14845 // Handle last resort GC and make sure to allow future allocations
14867 // to grow the heap without causing GCs (if possible). 14846 // to grow the heap without causing GCs (if possible).
14868 isolate->counters()->gc_last_resort_from_js()->Increment(); 14847 isolate->counters()->gc_last_resort_from_js()->Increment();
14869 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14848 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14870 "Runtime::PerformGC"); 14849 "Runtime::PerformGC");
14871 } 14850 }
14872 } 14851 }
14873 14852
14874 14853
14875 } } // namespace v8::internal 14854 } } // namespace v8::internal
OLDNEW
« src/objects.cc ('K') | « src/runtime.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698