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

Side by Side Diff: src/runtime.cc

Issue 77293003: Addressed perf regression in Browsermark2.0 array blur test (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed some unnecessary changes. 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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 547
548 literals->set(literals_index, *site); 548 literals->set(literals_index, *site);
549 } else { 549 } else {
550 site = Handle<AllocationSite>::cast(literal_site); 550 site = Handle<AllocationSite>::cast(literal_site);
551 } 551 }
552 552
553 return site; 553 return site;
554 } 554 }
555 555
556 556
557 static MaybeObject* CreateArrayLiteralImpl(Isolate* isolate,
558 Handle<FixedArray> literals,
559 int literals_index,
560 Handle<FixedArray> elements,
561 int flags) {
562 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals,
563 literals_index, elements);
564 RETURN_IF_EMPTY_HANDLE(isolate, site);
565
566 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info()));
567 if ((flags & ArrayLiteral::kShallowElements) != 0) {
568 if (boilerplate->elements()->map() ==
569 isolate->heap()->fixed_cow_array_map()) {
570 isolate->counters()->cow_arrays_created_runtime()->Increment();
571 }
572
573 if ((flags & ArrayLiteral::kDisableMementos) == 0 &&
574 AllocationSite::GetMode(boilerplate->GetElementsKind()) ==
575 TRACK_ALLOCATION_SITE) {
576 return isolate->heap()->CopyJSObject(*boilerplate, *site);
577 }
578
579 return isolate->heap()->CopyJSObject(*boilerplate);
580 } else {
581 AllocationSiteUsageContext usage_context(isolate, site,
582 (flags & ArrayLiteral::kDisableMementos) == 0);
583 usage_context.EnterNewScope();
584 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context);
585 usage_context.ExitScope(site, boilerplate);
586 RETURN_IF_EMPTY_HANDLE(isolate, copy);
587 return *copy;
588 }
589 }
590
591
557 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { 592 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) {
558 HandleScope scope(isolate); 593 HandleScope scope(isolate);
594 ASSERT(args.length() == 4);
595 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
596 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
597 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
598 CONVERT_SMI_ARG_CHECKED(flags, 3);
599
600 return CreateArrayLiteralImpl(isolate, literals, literals_index, elements,
601 flags);
602 }
603
604
605 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralStubBailout) {
606 HandleScope scope(isolate);
559 ASSERT(args.length() == 3); 607 ASSERT(args.length() == 3);
560 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 608 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
561 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 609 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
562 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); 610 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
563 611
564 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals, 612 return CreateArrayLiteralImpl(isolate, literals, literals_index, elements,
565 literals_index, elements); 613 ArrayLiteral::kShallowElements);
566 RETURN_IF_EMPTY_HANDLE(isolate, site);
567
568 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info()));
569 AllocationSiteUsageContext usage_context(isolate, site, true);
570 usage_context.EnterNewScope();
571 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context);
572 usage_context.ExitScope(site, boilerplate);
573 RETURN_IF_EMPTY_HANDLE(isolate, copy);
574 return *copy;
575 } 614 }
576 615
577 616
578 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { 617 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) {
579 HandleScope scope(isolate); 618 HandleScope scope(isolate);
580 ASSERT(args.length() == 1); 619 ASSERT(args.length() == 1);
581 Handle<Object> name(args[0], isolate); 620 Handle<Object> name(args[0], isolate);
582 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); 621 RUNTIME_ASSERT(name->IsString() || name->IsUndefined());
583 Symbol* symbol; 622 Symbol* symbol;
584 MaybeObject* maybe = isolate->heap()->AllocateSymbol(); 623 MaybeObject* maybe = isolate->heap()->AllocateSymbol();
(...skipping 14332 matching lines...) Expand 10 before | Expand all | Expand 10 after
14917 // Handle last resort GC and make sure to allow future allocations 14956 // Handle last resort GC and make sure to allow future allocations
14918 // to grow the heap without causing GCs (if possible). 14957 // to grow the heap without causing GCs (if possible).
14919 isolate->counters()->gc_last_resort_from_js()->Increment(); 14958 isolate->counters()->gc_last_resort_from_js()->Increment();
14920 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14959 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14921 "Runtime::PerformGC"); 14960 "Runtime::PerformGC");
14922 } 14961 }
14923 } 14962 }
14924 14963
14925 14964
14926 } } // namespace v8::internal 14965 } } // namespace v8::internal
OLDNEW
« src/ast.h ('K') | « src/runtime.h ('k') | test/mjsunit/array-literal-feedback.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698