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

Side by Side Diff: src/runtime.cc

Issue 18749004: Rename AllocationSite::payload to AllocationSite::transition_info (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 5 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-printer.cc ('k') | src/x64/code-stubs-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 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 Handle<FixedArray> elements) { 508 Handle<FixedArray> elements) {
509 // Check if boilerplate exists. If not, create it first. 509 // Check if boilerplate exists. If not, create it first.
510 Handle<Object> literal_site(literals->get(literals_index), isolate); 510 Handle<Object> literal_site(literals->get(literals_index), isolate);
511 Handle<AllocationSite> site; 511 Handle<AllocationSite> site;
512 if (*literal_site == isolate->heap()->undefined_value()) { 512 if (*literal_site == isolate->heap()->undefined_value()) {
513 ASSERT(*elements != isolate->heap()->empty_fixed_array()); 513 ASSERT(*elements != isolate->heap()->empty_fixed_array());
514 Handle<Object> boilerplate = 514 Handle<Object> boilerplate =
515 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); 515 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements);
516 if (boilerplate.is_null()) return site; 516 if (boilerplate.is_null()) return site;
517 site = isolate->factory()->NewAllocationSite(); 517 site = isolate->factory()->NewAllocationSite();
518 site->set_payload(*boilerplate); 518 site->set_transition_info(*boilerplate);
519 literals->set(literals_index, *site); 519 literals->set(literals_index, *site);
520 } else { 520 } else {
521 site = Handle<AllocationSite>::cast(literal_site); 521 site = Handle<AllocationSite>::cast(literal_site);
522 } 522 }
523 523
524 return site; 524 return site;
525 } 525 }
526 526
527 527
528 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { 528 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) {
529 HandleScope scope(isolate); 529 HandleScope scope(isolate);
530 ASSERT(args.length() == 3); 530 ASSERT(args.length() == 3);
531 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 531 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
532 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 532 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
533 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); 533 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
534 534
535 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals, 535 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals,
536 literals_index, elements); 536 literals_index, elements);
537 RETURN_IF_EMPTY_HANDLE(isolate, site); 537 RETURN_IF_EMPTY_HANDLE(isolate, site);
538 538
539 JSObject* boilerplate = JSObject::cast(site->payload()); 539 JSObject* boilerplate = JSObject::cast(site->transition_info());
540 return boilerplate->DeepCopy(isolate); 540 return boilerplate->DeepCopy(isolate);
541 } 541 }
542 542
543 543
544 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { 544 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) {
545 HandleScope scope(isolate); 545 HandleScope scope(isolate);
546 ASSERT(args.length() == 3); 546 ASSERT(args.length() == 3);
547 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 547 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
548 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 548 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
549 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); 549 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
550 550
551 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals, 551 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals,
552 literals_index, elements); 552 literals_index, elements);
553 RETURN_IF_EMPTY_HANDLE(isolate, site); 553 RETURN_IF_EMPTY_HANDLE(isolate, site);
554 554
555 JSObject* boilerplate = JSObject::cast(site->payload()); 555 JSObject* boilerplate = JSObject::cast(site->transition_info());
556 if (boilerplate->elements()->map() == 556 if (boilerplate->elements()->map() ==
557 isolate->heap()->fixed_cow_array_map()) { 557 isolate->heap()->fixed_cow_array_map()) {
558 isolate->counters()->cow_arrays_created_runtime()->Increment(); 558 isolate->counters()->cow_arrays_created_runtime()->Increment();
559 } 559 }
560 560
561 AllocationSiteMode mode = AllocationSite::GetMode( 561 AllocationSiteMode mode = AllocationSite::GetMode(
562 boilerplate->GetElementsKind()); 562 boilerplate->GetElementsKind());
563 if (mode == TRACK_ALLOCATION_SITE) { 563 if (mode == TRACK_ALLOCATION_SITE) {
564 return isolate->heap()->CopyJSObjectWithAllocationSite( 564 return isolate->heap()->CopyJSObjectWithAllocationSite(
565 boilerplate, *site); 565 boilerplate, *site);
(...skipping 4648 matching lines...) Expand 10 before | Expand all | Expand 10 after
5214 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 5214 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
5215 CONVERT_SMI_ARG_CHECKED(store_index, 1); 5215 CONVERT_SMI_ARG_CHECKED(store_index, 1);
5216 Handle<Object> value = args.at<Object>(2); 5216 Handle<Object> value = args.at<Object>(2);
5217 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3); 5217 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3);
5218 CONVERT_SMI_ARG_CHECKED(literal_index, 4); 5218 CONVERT_SMI_ARG_CHECKED(literal_index, 4);
5219 5219
5220 Object* raw_literal_cell = literals->get(literal_index); 5220 Object* raw_literal_cell = literals->get(literal_index);
5221 JSArray* boilerplate = NULL; 5221 JSArray* boilerplate = NULL;
5222 if (raw_literal_cell->IsAllocationSite()) { 5222 if (raw_literal_cell->IsAllocationSite()) {
5223 AllocationSite* site = AllocationSite::cast(raw_literal_cell); 5223 AllocationSite* site = AllocationSite::cast(raw_literal_cell);
5224 boilerplate = JSArray::cast(site->payload()); 5224 boilerplate = JSArray::cast(site->transition_info());
5225 } else { 5225 } else {
5226 boilerplate = JSArray::cast(raw_literal_cell); 5226 boilerplate = JSArray::cast(raw_literal_cell);
5227 } 5227 }
5228 Handle<JSArray> boilerplate_object(boilerplate); 5228 Handle<JSArray> boilerplate_object(boilerplate);
5229 ElementsKind elements_kind = object->GetElementsKind(); 5229 ElementsKind elements_kind = object->GetElementsKind();
5230 ASSERT(IsFastElementsKind(elements_kind)); 5230 ASSERT(IsFastElementsKind(elements_kind));
5231 // Smis should never trigger transitions. 5231 // Smis should never trigger transitions.
5232 ASSERT(!value->IsSmi()); 5232 ASSERT(!value->IsSmi());
5233 5233
5234 if (value->IsNumber()) { 5234 if (value->IsNumber()) {
(...skipping 8603 matching lines...) Expand 10 before | Expand all | Expand 10 after
13838 JSArray* array; 13838 JSArray* array;
13839 MaybeObject* maybe_array; 13839 MaybeObject* maybe_array;
13840 if (!type_info.is_null() && 13840 if (!type_info.is_null() &&
13841 *type_info != isolate->heap()->undefined_value() && 13841 *type_info != isolate->heap()->undefined_value() &&
13842 Cell::cast(*type_info)->value()->IsAllocationSite() && 13842 Cell::cast(*type_info)->value()->IsAllocationSite() &&
13843 can_use_type_feedback) { 13843 can_use_type_feedback) {
13844 Handle<Cell> cell = Handle<Cell>::cast(type_info); 13844 Handle<Cell> cell = Handle<Cell>::cast(type_info);
13845 Handle<AllocationSite> site = Handle<AllocationSite>( 13845 Handle<AllocationSite> site = Handle<AllocationSite>(
13846 AllocationSite::cast(cell->value()), isolate); 13846 AllocationSite::cast(cell->value()), isolate);
13847 ASSERT(!site->IsLiteralSite()); 13847 ASSERT(!site->IsLiteralSite());
13848 ElementsKind to_kind = site->GetElementsKindPayload(); 13848 ElementsKind to_kind = site->GetElementsKind();
13849 if (holey && !IsFastHoleyElementsKind(to_kind)) { 13849 if (holey && !IsFastHoleyElementsKind(to_kind)) {
13850 to_kind = GetHoleyElementsKind(to_kind); 13850 to_kind = GetHoleyElementsKind(to_kind);
13851 // Update the allocation site info to reflect the advice alteration. 13851 // Update the allocation site info to reflect the advice alteration.
13852 site->SetElementsKindPayload(to_kind); 13852 site->SetElementsKind(to_kind);
13853 } 13853 }
13854 13854
13855 maybe_array = isolate->heap()->AllocateJSObjectWithAllocationSite( 13855 maybe_array = isolate->heap()->AllocateJSObjectWithAllocationSite(
13856 *constructor, site); 13856 *constructor, site);
13857 if (!maybe_array->To(&array)) return maybe_array; 13857 if (!maybe_array->To(&array)) return maybe_array;
13858 } else { 13858 } else {
13859 maybe_array = isolate->heap()->AllocateJSObject(*constructor); 13859 maybe_array = isolate->heap()->AllocateJSObject(*constructor);
13860 if (!maybe_array->To(&array)) return maybe_array; 13860 if (!maybe_array->To(&array)) return maybe_array;
13861 // We might need to transition to holey 13861 // We might need to transition to holey
13862 ElementsKind kind = constructor->initial_map()->elements_kind(); 13862 ElementsKind kind = constructor->initial_map()->elements_kind();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
13995 // Handle last resort GC and make sure to allow future allocations 13995 // Handle last resort GC and make sure to allow future allocations
13996 // to grow the heap without causing GCs (if possible). 13996 // to grow the heap without causing GCs (if possible).
13997 isolate->counters()->gc_last_resort_from_js()->Increment(); 13997 isolate->counters()->gc_last_resort_from_js()->Increment();
13998 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13998 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13999 "Runtime::PerformGC"); 13999 "Runtime::PerformGC");
14000 } 14000 }
14001 } 14001 }
14002 14002
14003 14003
14004 } } // namespace v8::internal 14004 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698