Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 4202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4213 descriptor->Initialize( | 4213 descriptor->Initialize( |
| 4214 FUNCTION_ADDR(Runtime_BinaryOpIC_MissWithAllocationSite)); | 4214 FUNCTION_ADDR(Runtime_BinaryOpIC_MissWithAllocationSite)); |
| 4215 } | 4215 } |
| 4216 | 4216 |
| 4217 | 4217 |
| 4218 void StringAddStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { | 4218 void StringAddStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
| 4219 descriptor->Initialize(Runtime::FunctionForId(Runtime::kStringAdd)->entry); | 4219 descriptor->Initialize(Runtime::FunctionForId(Runtime::kStringAdd)->entry); |
| 4220 descriptor->SetMissHandler(Runtime::kStringAdd); | 4220 descriptor->SetMissHandler(Runtime::kStringAdd); |
| 4221 } | 4221 } |
| 4222 | 4222 |
| 4223 | |
| 4224 void GrowArrayElementsStub::InitializeDescriptor( | |
| 4225 CodeStubDescriptor* descriptor) { | |
| 4226 descriptor->Initialize( | |
| 4227 Runtime::FunctionForId(Runtime::kGrowArrayElements)->entry); | |
| 4228 } | |
| 4229 | |
| 4230 | |
| 4231 namespace { | 4223 namespace { |
| 4232 | 4224 |
| 4233 compiler::Node* GenerateHasProperty( | 4225 compiler::Node* GenerateHasProperty( |
| 4234 CodeStubAssembler* assembler, compiler::Node* object, compiler::Node* key, | 4226 CodeStubAssembler* assembler, compiler::Node* object, compiler::Node* key, |
| 4235 compiler::Node* context, Runtime::FunctionId fallback_runtime_function_id) { | 4227 compiler::Node* context, Runtime::FunctionId fallback_runtime_function_id) { |
| 4236 typedef compiler::Node Node; | 4228 typedef compiler::Node Node; |
| 4237 typedef CodeStubAssembler::Label Label; | 4229 typedef CodeStubAssembler::Label Label; |
| 4238 typedef CodeStubAssembler::Variable Variable; | 4230 typedef CodeStubAssembler::Variable Variable; |
| 4239 | 4231 |
| 4240 Label call_runtime(assembler, Label::kDeferred), return_true(assembler), | 4232 Label call_runtime(assembler, Label::kDeferred), return_true(assembler), |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4990 CodeStubAssembler* assembler) const { | 4982 CodeStubAssembler* assembler) const { |
| 4991 typedef compiler::Node Node; | 4983 typedef compiler::Node Node; |
| 4992 Node* function = assembler->Parameter(Descriptor::kFunction); | 4984 Node* function = assembler->Parameter(Descriptor::kFunction); |
| 4993 Node* array_map = assembler->LoadObjectField( | 4985 Node* array_map = assembler->LoadObjectField( |
| 4994 function, JSFunction::kPrototypeOrInitialMapOffset); | 4986 function, JSFunction::kPrototypeOrInitialMapOffset); |
| 4995 SingleArgumentConstructorCommon<Descriptor>( | 4987 SingleArgumentConstructorCommon<Descriptor>( |
| 4996 assembler, elements_kind(), array_map, assembler->UndefinedConstant(), | 4988 assembler, elements_kind(), array_map, assembler->UndefinedConstant(), |
| 4997 DONT_TRACK_ALLOCATION_SITE); | 4989 DONT_TRACK_ALLOCATION_SITE); |
| 4998 } | 4990 } |
| 4999 | 4991 |
| 4992 void GrowArrayElementsStub::GenerateAssembly( | |
| 4993 CodeStubAssembler* assembler) const { | |
| 4994 typedef compiler::Node Node; | |
| 4995 CodeStubAssembler::Label runtime(assembler, | |
| 4996 CodeStubAssembler::Label::kDeferred); | |
| 4997 | |
| 4998 Node* object = assembler->Parameter(Descriptor::kObject); | |
| 4999 Node* key = assembler->Parameter(Descriptor::kKey); | |
| 5000 Node* context = assembler->Parameter(Descriptor::kContext); | |
| 5001 | |
| 5002 ElementsKind kind = elements_kind(); | |
| 5003 | |
| 5004 Node* elements = assembler->LoadElements(object); | |
| 5005 Node* current_capacity = assembler->LoadFixedArrayBaseLength(elements); | |
| 5006 | |
| 5007 Node* new_elements = assembler->CheckAndGrowElementsCapacity( | |
| 5008 context, object, elements, kind, current_capacity, key, &runtime); | |
| 5009 | |
| 5010 assembler->StoreObjectField(object, JSObject::kElementsOffset, new_elements); | |
| 5011 | |
| 5012 assembler->Return(new_elements); | |
| 5013 | |
| 5014 assembler->Bind(&runtime); | |
| 5015 // TODO(danno): Make this a tail call when the stub is only used from TurboFan | |
|
Benedikt Meurer
2016/08/05 04:35:21
Ouch!
| |
| 5016 // code. This musn't be a tail call for now, since the caller site in lithium | |
| 5017 // creates a safepoint. This safepoint musn't have a different number of | |
| 5018 // arguments on the stack in the case that a GC happens from the slow-case | |
| 5019 // allocation path (zero, since all the stubs inputs are in registers) and | |
| 5020 // when the call happens (it would be two in the tail call case due to the | |
| 5021 // tail call pushing the arguments on the stack for the runtime call). By not | |
| 5022 // tail-calling, the runtime call case also has zero arguments on the stack | |
| 5023 // for the stub frame. | |
| 5024 assembler->Return(assembler->CallRuntime(Runtime::kGrowArrayElements, context, | |
| 5025 object, key)); | |
| 5026 } | |
| 5027 | |
| 5000 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 5028 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
| 5001 : PlatformCodeStub(isolate) { | 5029 : PlatformCodeStub(isolate) { |
| 5002 minor_key_ = ArgumentCountBits::encode(ANY); | 5030 minor_key_ = ArgumentCountBits::encode(ANY); |
| 5003 } | 5031 } |
| 5004 | 5032 |
| 5005 | |
| 5006 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate, | 5033 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate, |
| 5007 int argument_count) | 5034 int argument_count) |
| 5008 : PlatformCodeStub(isolate) { | 5035 : PlatformCodeStub(isolate) { |
| 5009 if (argument_count == 0) { | 5036 if (argument_count == 0) { |
| 5010 minor_key_ = ArgumentCountBits::encode(NONE); | 5037 minor_key_ = ArgumentCountBits::encode(NONE); |
| 5011 } else if (argument_count == 1) { | 5038 } else if (argument_count == 1) { |
| 5012 minor_key_ = ArgumentCountBits::encode(ONE); | 5039 minor_key_ = ArgumentCountBits::encode(ONE); |
| 5013 } else if (argument_count >= 2) { | 5040 } else if (argument_count >= 2) { |
| 5014 minor_key_ = ArgumentCountBits::encode(MORE_THAN_ONE); | 5041 minor_key_ = ArgumentCountBits::encode(MORE_THAN_ONE); |
| 5015 } else { | 5042 } else { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 5032 if (type->Is(Type::UntaggedPointer())) { | 5059 if (type->Is(Type::UntaggedPointer())) { |
| 5033 return Representation::External(); | 5060 return Representation::External(); |
| 5034 } | 5061 } |
| 5035 | 5062 |
| 5036 DCHECK(!type->Is(Type::Untagged())); | 5063 DCHECK(!type->Is(Type::Untagged())); |
| 5037 return Representation::Tagged(); | 5064 return Representation::Tagged(); |
| 5038 } | 5065 } |
| 5039 | 5066 |
| 5040 } // namespace internal | 5067 } // namespace internal |
| 5041 } // namespace v8 | 5068 } // namespace v8 |
| OLD | NEW |