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

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

Issue 1874693002: Version 5.1.294.2 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.1.294
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 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after
3209 &if_keyisinvalid); 3209 &if_keyisinvalid);
3210 assembler->Bind(&if_keyispositivesmi); 3210 assembler->Bind(&if_keyispositivesmi);
3211 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context, 3211 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context,
3212 receiver, key); 3212 receiver, key);
3213 3213
3214 assembler->Bind(&if_keyisinvalid); 3214 assembler->Bind(&if_keyisinvalid);
3215 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, 3215 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key,
3216 slot, vector); 3216 slot, vector);
3217 } 3217 }
3218 3218
3219 void FastCloneShallowObjectStub::GenerateAssembly(
3220 compiler::CodeStubAssembler* assembler) const {
3221 typedef compiler::CodeStubAssembler::Label Label;
3222 typedef compiler::Node Node;
3223 Label call_runtime(assembler);
3224 Node* closure = assembler->Parameter(0);
3225 Node* literals_index = assembler->Parameter(1);
3226
3227 Node* undefined = assembler->UndefinedConstant();
3228 Node* literals_array =
3229 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset);
3230 Node* allocation_site = assembler->LoadFixedArrayElementSmiIndex(
3231 literals_array, literals_index,
3232 LiteralsArray::kFirstLiteralIndex * kPointerSize);
3233 assembler->GotoIf(assembler->WordEqual(allocation_site, undefined),
3234 &call_runtime);
3235
3236 Node* boilerplate = assembler->LoadObjectField(
3237 allocation_site, AllocationSite::kTransitionInfoOffset);
3238
3239 int length = this->length();
3240 if (length == 0) {
3241 length = JSObject::kInitialGlobalObjectUnusedPropertiesCount;
3242 }
3243 int size = JSObject::kHeaderSize + length * kPointerSize;
3244 int object_size = size;
3245 if (FLAG_allocation_site_pretenuring) {
3246 size += AllocationMemento::kSize;
3247 }
3248
3249 Node* boilerplate_map = assembler->LoadMap(boilerplate);
3250 Node* instance_size = assembler->LoadMapInstanceSize(boilerplate_map);
3251 Node* size_in_words =
3252 assembler->Int32Constant(object_size >> kPointerSizeLog2);
3253 assembler->GotoUnless(assembler->Word32Equal(instance_size, size_in_words),
3254 &call_runtime);
3255
3256 Node* copy = assembler->Allocate(size);
3257
3258 for (int i = 0; i < size; i += kPointerSize) {
3259 // The Allocate above guarantees that the copy lies in new space. This
3260 // allows us to skip write barriers. This is necessary since we may also be
3261 // copying unboxed doubles.
3262 Node* field =
3263 assembler->LoadObjectField(boilerplate, i, MachineType::IntPtr());
3264 assembler->StoreObjectFieldNoWriteBarrier(
3265 copy, i, field, MachineType::PointerRepresentation());
3266 }
3267
3268 if (FLAG_allocation_site_pretenuring) {
3269 Node* memento = assembler->InnerAllocate(copy, object_size);
3270 assembler->StoreObjectFieldNoWriteBarrier(
3271 memento, HeapObject::kMapOffset,
3272 assembler->LoadRoot(Heap::kAllocationMementoMapRootIndex));
3273 assembler->StoreObjectFieldNoWriteBarrier(
3274 memento, AllocationMemento::kAllocationSiteOffset, allocation_site);
3275 Node* memento_create_count = assembler->LoadObjectField(
3276 allocation_site, AllocationSite::kPretenureCreateCountOffset);
3277 memento_create_count = assembler->SmiAdd(
3278 memento_create_count, assembler->SmiConstant(Smi::FromInt(1)));
3279 assembler->StoreObjectFieldNoWriteBarrier(
3280 allocation_site, AllocationSite::kPretenureCreateCountOffset,
3281 memento_create_count);
3282 }
3283
3284 // TODO(verwaest): Allocate and fill in double boxes.
3285 assembler->Return(copy);
3286
3287 assembler->Bind(&call_runtime);
3288 Node* constant_properties = assembler->Parameter(2);
3289 Node* flags = assembler->Parameter(3);
3290 Node* context = assembler->Parameter(4);
3291 assembler->TailCallRuntime(Runtime::kCreateObjectLiteral, context, closure,
3292 literals_index, constant_properties, flags);
3293 }
3294
3219 template<class StateType> 3295 template<class StateType>
3220 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { 3296 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) {
3221 // Note: Although a no-op transition is semantically OK, it is hinting at a 3297 // Note: Although a no-op transition is semantically OK, it is hinting at a
3222 // bug somewhere in our state transition machinery. 3298 // bug somewhere in our state transition machinery.
3223 DCHECK(from != to); 3299 DCHECK(from != to);
3224 if (!FLAG_trace_ic) return; 3300 if (!FLAG_trace_ic) return;
3225 OFStream os(stdout); 3301 OFStream os(stdout);
3226 os << "["; 3302 os << "[";
3227 PrintBaseName(os); 3303 PrintBaseName(os);
3228 os << ": " << from << "=>" << to << "]" << std::endl; 3304 os << ": " << from << "=>" << to << "]" << std::endl;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
3355 3431
3356 3432
3357 void FastCloneShallowArrayStub::InitializeDescriptor( 3433 void FastCloneShallowArrayStub::InitializeDescriptor(
3358 CodeStubDescriptor* descriptor) { 3434 CodeStubDescriptor* descriptor) {
3359 FastCloneShallowArrayDescriptor call_descriptor(isolate()); 3435 FastCloneShallowArrayDescriptor call_descriptor(isolate());
3360 descriptor->Initialize( 3436 descriptor->Initialize(
3361 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry); 3437 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry);
3362 } 3438 }
3363 3439
3364 3440
3365 void FastCloneShallowObjectStub::InitializeDescriptor(
3366 CodeStubDescriptor* descriptor) {
3367 FastCloneShallowObjectDescriptor call_descriptor(isolate());
3368 descriptor->Initialize(
3369 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
3370 }
3371
3372
3373 void CreateAllocationSiteStub::InitializeDescriptor(CodeStubDescriptor* d) {} 3441 void CreateAllocationSiteStub::InitializeDescriptor(CodeStubDescriptor* d) {}
3374 3442
3375 3443
3376 void CreateWeakCellStub::InitializeDescriptor(CodeStubDescriptor* d) {} 3444 void CreateWeakCellStub::InitializeDescriptor(CodeStubDescriptor* d) {}
3377 3445
3378 3446
3379 void RegExpConstructResultStub::InitializeDescriptor( 3447 void RegExpConstructResultStub::InitializeDescriptor(
3380 CodeStubDescriptor* descriptor) { 3448 CodeStubDescriptor* descriptor) {
3381 descriptor->Initialize( 3449 descriptor->Initialize(
3382 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); 3450 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
3652 if (type->Is(Type::UntaggedPointer())) { 3720 if (type->Is(Type::UntaggedPointer())) {
3653 return Representation::External(); 3721 return Representation::External();
3654 } 3722 }
3655 3723
3656 DCHECK(!type->Is(Type::Untagged())); 3724 DCHECK(!type->Is(Type::Untagged()));
3657 return Representation::Tagged(); 3725 return Representation::Tagged();
3658 } 3726 }
3659 3727
3660 } // namespace internal 3728 } // namespace internal
3661 } // namespace v8 3729 } // 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