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

Side by Side Diff: src/code-stubs.cc

Issue 1875683002: Revert of Migrate FastCloneShallowObjectStub to TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 3060 matching lines...) Expand 10 before | Expand all | Expand 10 after
3071 &if_keyisinvalid); 3071 &if_keyisinvalid);
3072 assembler->Bind(&if_keyispositivesmi); 3072 assembler->Bind(&if_keyispositivesmi);
3073 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context, 3073 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context,
3074 receiver, key); 3074 receiver, key);
3075 3075
3076 assembler->Bind(&if_keyisinvalid); 3076 assembler->Bind(&if_keyisinvalid);
3077 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, 3077 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key,
3078 slot, vector); 3078 slot, vector);
3079 } 3079 }
3080 3080
3081 void FastCloneShallowObjectStub::GenerateAssembly(
3082 compiler::CodeStubAssembler* assembler) const {
3083 typedef compiler::CodeStubAssembler::Label Label;
3084 typedef compiler::Node Node;
3085 Label call_runtime(assembler);
3086 Node* closure = assembler->Parameter(0);
3087 Node* literals_index = assembler->Parameter(1);
3088
3089 Node* undefined = assembler->UndefinedConstant();
3090 Node* literals_array =
3091 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset);
3092 Node* allocation_site = assembler->LoadFixedArrayElementSmiIndex(
3093 literals_array, literals_index,
3094 LiteralsArray::kFirstLiteralIndex * kPointerSize);
3095 assembler->GotoIf(assembler->WordEqual(allocation_site, undefined),
3096 &call_runtime);
3097
3098 Node* boilerplate = assembler->LoadObjectField(
3099 allocation_site, AllocationSite::kTransitionInfoOffset);
3100
3101 int length = this->length();
3102 if (length == 0) {
3103 length = JSObject::kInitialGlobalObjectUnusedPropertiesCount;
3104 }
3105 int size = JSObject::kHeaderSize + length * kPointerSize;
3106 int object_size = size;
3107 if (FLAG_allocation_site_pretenuring) {
3108 size += AllocationMemento::kSize;
3109 }
3110
3111 Node* boilerplate_map = assembler->LoadMap(boilerplate);
3112 Node* instance_size = assembler->LoadMapInstanceSize(boilerplate_map);
3113 Node* size_in_words =
3114 assembler->Int32Constant(object_size >> kPointerSizeLog2);
3115 assembler->GotoUnless(assembler->Word32Equal(instance_size, size_in_words),
3116 &call_runtime);
3117
3118 Node* copy = assembler->Allocate(size);
3119
3120 for (int i = 0; i < size; i += kPointerSize) {
3121 // The Allocate above guarantees that the copy lies in new space. This
3122 // allows us to skip write barriers. This is necessary since we may also be
3123 // copying unboxed doubles.
3124 Node* field =
3125 assembler->LoadObjectField(boilerplate, i, MachineType::IntPtr());
3126 assembler->StoreObjectFieldNoWriteBarrier(
3127 copy, i, field, MachineType::PointerRepresentation());
3128 }
3129
3130 if (FLAG_allocation_site_pretenuring) {
3131 Node* memento = assembler->InnerAllocate(copy, object_size);
3132 assembler->StoreObjectFieldNoWriteBarrier(
3133 memento, HeapObject::kMapOffset,
3134 assembler->LoadRoot(Heap::kAllocationMementoMapRootIndex));
3135 assembler->StoreObjectFieldNoWriteBarrier(
3136 memento, AllocationMemento::kAllocationSiteOffset, allocation_site);
3137 Node* memento_create_count = assembler->LoadObjectField(
3138 allocation_site, AllocationSite::kPretenureCreateCountOffset);
3139 memento_create_count = assembler->SmiAdd(
3140 memento_create_count, assembler->SmiConstant(Smi::FromInt(1)));
3141 assembler->StoreObjectFieldNoWriteBarrier(
3142 allocation_site, AllocationSite::kPretenureCreateCountOffset,
3143 memento_create_count);
3144 }
3145
3146 // TODO(verwaest): Allocate and fill in double boxes.
3147 assembler->Return(copy);
3148
3149 assembler->Bind(&call_runtime);
3150 Node* constant_properties = assembler->Parameter(2);
3151 Node* flags = assembler->Parameter(3);
3152 Node* context = assembler->Parameter(4);
3153 assembler->TailCallRuntime(Runtime::kCreateObjectLiteral, context, closure,
3154 literals_index, constant_properties, flags);
3155 }
3156
3157 template<class StateType> 3081 template<class StateType>
3158 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { 3082 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) {
3159 // Note: Although a no-op transition is semantically OK, it is hinting at a 3083 // Note: Although a no-op transition is semantically OK, it is hinting at a
3160 // bug somewhere in our state transition machinery. 3084 // bug somewhere in our state transition machinery.
3161 DCHECK(from != to); 3085 DCHECK(from != to);
3162 if (!FLAG_trace_ic) return; 3086 if (!FLAG_trace_ic) return;
3163 OFStream os(stdout); 3087 OFStream os(stdout);
3164 os << "["; 3088 os << "[";
3165 PrintBaseName(os); 3089 PrintBaseName(os);
3166 os << ": " << from << "=>" << to << "]" << std::endl; 3090 os << ": " << from << "=>" << to << "]" << std::endl;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
3293 3217
3294 3218
3295 void FastCloneShallowArrayStub::InitializeDescriptor( 3219 void FastCloneShallowArrayStub::InitializeDescriptor(
3296 CodeStubDescriptor* descriptor) { 3220 CodeStubDescriptor* descriptor) {
3297 FastCloneShallowArrayDescriptor call_descriptor(isolate()); 3221 FastCloneShallowArrayDescriptor call_descriptor(isolate());
3298 descriptor->Initialize( 3222 descriptor->Initialize(
3299 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry); 3223 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry);
3300 } 3224 }
3301 3225
3302 3226
3227 void FastCloneShallowObjectStub::InitializeDescriptor(
3228 CodeStubDescriptor* descriptor) {
3229 FastCloneShallowObjectDescriptor call_descriptor(isolate());
3230 descriptor->Initialize(
3231 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
3232 }
3233
3234
3303 void CreateAllocationSiteStub::InitializeDescriptor(CodeStubDescriptor* d) {} 3235 void CreateAllocationSiteStub::InitializeDescriptor(CodeStubDescriptor* d) {}
3304 3236
3305 3237
3306 void CreateWeakCellStub::InitializeDescriptor(CodeStubDescriptor* d) {} 3238 void CreateWeakCellStub::InitializeDescriptor(CodeStubDescriptor* d) {}
3307 3239
3308 3240
3309 void RegExpConstructResultStub::InitializeDescriptor( 3241 void RegExpConstructResultStub::InitializeDescriptor(
3310 CodeStubDescriptor* descriptor) { 3242 CodeStubDescriptor* descriptor) {
3311 descriptor->Initialize( 3243 descriptor->Initialize(
3312 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); 3244 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
3582 if (type->Is(Type::UntaggedPointer())) { 3514 if (type->Is(Type::UntaggedPointer())) {
3583 return Representation::External(); 3515 return Representation::External();
3584 } 3516 }
3585 3517
3586 DCHECK(!type->Is(Type::Untagged())); 3518 DCHECK(!type->Is(Type::Untagged()));
3587 return Representation::Tagged(); 3519 return Representation::Tagged();
3588 } 3520 }
3589 3521
3590 } // namespace internal 3522 } // namespace internal
3591 } // namespace v8 3523 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698