2012-02-10 12:36:05 +00:00
|
|
|
// Copyright 2012 the V8 project authors. All rights reserved.
|
2008-07-03 15:10:15 +00:00
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are
|
|
|
|
// met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above
|
|
|
|
// copyright notice, this list of conditions and the following
|
|
|
|
// disclaimer in the documentation and/or other materials provided
|
|
|
|
// with the distribution.
|
|
|
|
// * Neither the name of Google Inc. nor the names of its
|
|
|
|
// contributors may be used to endorse or promote products derived
|
|
|
|
// from this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
#include "v8.h"
|
|
|
|
|
|
|
|
#include "bootstrapper.h"
|
|
|
|
#include "code-stubs.h"
|
2013-07-03 15:39:18 +00:00
|
|
|
#include "cpu-profiler.h"
|
2011-05-18 13:17:29 +00:00
|
|
|
#include "stub-cache.h"
|
2008-07-03 15:10:15 +00:00
|
|
|
#include "factory.h"
|
2011-01-18 16:11:01 +00:00
|
|
|
#include "gdb-jit.h"
|
2008-07-03 15:10:15 +00:00
|
|
|
#include "macro-assembler.h"
|
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-04-18 20:37:27 +00:00
|
|
|
|
|
|
|
CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor()
|
|
|
|
: register_param_count_(-1),
|
2013-10-18 14:55:21 +00:00
|
|
|
stack_parameter_count_(no_reg),
|
2013-04-25 16:00:32 +00:00
|
|
|
hint_stack_parameter_count_(-1),
|
2013-04-18 20:37:27 +00:00
|
|
|
function_mode_(NOT_JS_FUNCTION_STUB_MODE),
|
|
|
|
register_params_(NULL),
|
|
|
|
deoptimization_handler_(NULL),
|
2013-11-13 10:07:04 +00:00
|
|
|
handler_arguments_mode_(DONT_PASS_ARGUMENTS),
|
2013-09-03 06:57:16 +00:00
|
|
|
miss_handler_(),
|
2013-05-24 11:44:55 +00:00
|
|
|
has_miss_handler_(false) { }
|
2013-04-18 20:37:27 +00:00
|
|
|
|
|
|
|
|
2012-11-22 07:58:59 +00:00
|
|
|
bool CodeStub::FindCodeInCache(Code** code_out, Isolate* isolate) {
|
|
|
|
UnseededNumberDictionary* stubs = isolate->heap()->code_stubs();
|
|
|
|
int index = stubs->FindEntry(GetKey());
|
2012-01-16 09:44:35 +00:00
|
|
|
if (index != UnseededNumberDictionary::kNotFound) {
|
2012-11-22 07:58:59 +00:00
|
|
|
*code_out = Code::cast(stubs->ValueAt(index));
|
2009-12-09 14:54:34 +00:00
|
|
|
return true;
|
2009-11-04 08:51:48 +00:00
|
|
|
}
|
2009-12-09 14:54:34 +00:00
|
|
|
return false;
|
|
|
|
}
|
2009-11-04 08:51:48 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-09-09 22:39:47 +00:00
|
|
|
SmartArrayPointer<const char> CodeStub::GetName() {
|
2011-07-13 11:08:25 +00:00
|
|
|
char buffer[100];
|
|
|
|
NoAllocationStringAllocator allocator(buffer,
|
|
|
|
static_cast<unsigned>(sizeof(buffer)));
|
|
|
|
StringStream stream(&allocator);
|
|
|
|
PrintName(&stream);
|
|
|
|
return stream.ToCString();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-18 16:25:45 +00:00
|
|
|
void CodeStub::RecordCodeGeneration(Code* code, Isolate* isolate) {
|
2011-09-09 22:39:47 +00:00
|
|
|
SmartArrayPointer<const char> name = GetName();
|
2013-12-09 07:41:20 +00:00
|
|
|
PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, name.get()));
|
|
|
|
GDBJIT(AddCode(GDBJITInterface::STUB, name.get(), code));
|
2011-03-23 11:13:07 +00:00
|
|
|
Counters* counters = isolate->counters();
|
|
|
|
counters->total_stubs_code_size()->Increment(code->instruction_size());
|
2009-12-09 14:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-18 09:50:46 +00:00
|
|
|
Code::Kind CodeStub::GetCodeKind() const {
|
2010-03-01 16:24:05 +00:00
|
|
|
return Code::STUB;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-05 10:34:02 +00:00
|
|
|
Handle<Code> CodeStub::GetCodeCopyFromTemplate(Isolate* isolate) {
|
|
|
|
Handle<Code> ic = GetCode(isolate);
|
|
|
|
ic = isolate->factory()->CopyCode(ic);
|
|
|
|
RecordCodeGeneration(*ic, isolate);
|
|
|
|
return ic;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-09-03 06:57:16 +00:00
|
|
|
Handle<Code> PlatformCodeStub::GenerateCode(Isolate* isolate) {
|
2012-12-18 16:25:45 +00:00
|
|
|
Factory* factory = isolate->factory();
|
|
|
|
|
|
|
|
// Generate the new code.
|
|
|
|
MacroAssembler masm(isolate, NULL, 256);
|
|
|
|
|
|
|
|
{
|
|
|
|
// Update the static counter each time a new code stub is generated.
|
|
|
|
isolate->counters()->code_stubs()->Increment();
|
|
|
|
|
|
|
|
// Generate the code for the stub.
|
|
|
|
masm.set_generating_stub(true);
|
|
|
|
NoCurrentFrameScope scope(&masm);
|
|
|
|
Generate(&masm);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create the code object.
|
|
|
|
CodeDesc desc;
|
|
|
|
masm.GetCode(&desc);
|
|
|
|
|
|
|
|
// Copy the generated code into a heap object.
|
|
|
|
Code::Flags flags = Code::ComputeFlags(
|
2013-04-18 09:50:46 +00:00
|
|
|
GetCodeKind(),
|
2013-03-04 14:03:27 +00:00
|
|
|
GetICState(),
|
|
|
|
GetExtraICState(),
|
2014-02-14 15:15:08 +00:00
|
|
|
GetStubType());
|
2012-12-18 16:25:45 +00:00
|
|
|
Handle<Code> new_object = factory->NewCode(
|
|
|
|
desc, flags, masm.CodeObject(), NeedsImmovableCode());
|
|
|
|
return new_object;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-10 08:45:40 +00:00
|
|
|
void CodeStub::VerifyPlatformFeatures(Isolate* isolate) {
|
|
|
|
ASSERT(CpuFeatures::VerifyCrossCompiling());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-27 12:33:24 +00:00
|
|
|
Handle<Code> CodeStub::GetCode(Isolate* isolate) {
|
2011-03-28 13:33:48 +00:00
|
|
|
Factory* factory = isolate->factory();
|
|
|
|
Heap* heap = isolate->heap();
|
2009-12-09 14:54:34 +00:00
|
|
|
Code* code;
|
2011-12-09 09:26:14 +00:00
|
|
|
if (UseSpecialCache()
|
2012-11-22 07:58:59 +00:00
|
|
|
? FindCodeInSpecialCache(&code, isolate)
|
|
|
|
: FindCodeInCache(&code, isolate)) {
|
2013-10-04 08:17:11 +00:00
|
|
|
ASSERT(GetCodeKind() == code->kind());
|
2011-12-09 09:26:14 +00:00
|
|
|
return Handle<Code>(code);
|
|
|
|
}
|
|
|
|
|
2013-10-10 08:45:40 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
VerifyPlatformFeatures(isolate);
|
|
|
|
#endif
|
|
|
|
|
2011-12-09 09:26:14 +00:00
|
|
|
{
|
2011-03-28 13:33:48 +00:00
|
|
|
HandleScope scope(isolate);
|
2009-12-09 14:54:34 +00:00
|
|
|
|
2013-09-03 06:57:16 +00:00
|
|
|
Handle<Code> new_object = GenerateCode(isolate);
|
2012-04-26 16:19:14 +00:00
|
|
|
new_object->set_major_key(MajorKey());
|
2011-11-11 13:48:14 +00:00
|
|
|
FinishCode(new_object);
|
2012-12-18 16:25:45 +00:00
|
|
|
RecordCodeGeneration(*new_object, isolate);
|
2012-04-26 16:19:14 +00:00
|
|
|
|
|
|
|
#ifdef ENABLE_DISASSEMBLER
|
|
|
|
if (FLAG_print_code_stubs) {
|
2013-11-07 16:35:27 +00:00
|
|
|
CodeTracer::Scope trace_scope(isolate->GetCodeTracer());
|
2013-12-09 07:41:20 +00:00
|
|
|
new_object->Disassemble(GetName().get(), trace_scope.file());
|
2013-11-07 16:35:27 +00:00
|
|
|
PrintF(trace_scope.file(), "\n");
|
2012-04-26 16:19:14 +00:00
|
|
|
}
|
|
|
|
#endif
|
2009-12-09 14:54:34 +00:00
|
|
|
|
2011-12-09 09:26:14 +00:00
|
|
|
if (UseSpecialCache()) {
|
|
|
|
AddToSpecialCache(new_object);
|
|
|
|
} else {
|
|
|
|
// Update the dictionary and the root in Heap.
|
2012-01-16 09:44:35 +00:00
|
|
|
Handle<UnseededNumberDictionary> dict =
|
2011-12-09 09:26:14 +00:00
|
|
|
factory->DictionaryAtNumberPut(
|
2012-01-16 09:44:35 +00:00
|
|
|
Handle<UnseededNumberDictionary>(heap->code_stubs()),
|
2011-12-09 09:26:14 +00:00
|
|
|
GetKey(),
|
|
|
|
new_object);
|
|
|
|
heap->public_set_code_stubs(*dict);
|
|
|
|
}
|
2009-12-09 14:54:34 +00:00
|
|
|
code = *new_object;
|
|
|
|
}
|
|
|
|
|
2011-12-09 09:26:14 +00:00
|
|
|
Activate(code);
|
2012-09-14 11:16:56 +00:00
|
|
|
ASSERT(!NeedsImmovableCode() ||
|
|
|
|
heap->lo_space()->Contains(code) ||
|
|
|
|
heap->code_space()->FirstPage()->Contains(code->address()));
|
2011-03-28 13:33:48 +00:00
|
|
|
return Handle<Code>(code, isolate);
|
2009-12-09 14:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-05 13:07:00 +00:00
|
|
|
const char* CodeStub::MajorName(CodeStub::Major major_key,
|
|
|
|
bool allow_unknown_keys) {
|
2008-07-03 15:10:15 +00:00
|
|
|
switch (major_key) {
|
2011-07-08 09:40:14 +00:00
|
|
|
#define DEF_CASE(name) case name: return #name "Stub";
|
2009-11-11 14:32:14 +00:00
|
|
|
CODE_STUB_LIST(DEF_CASE)
|
2009-10-26 12:26:42 +00:00
|
|
|
#undef DEF_CASE
|
2013-12-13 10:27:19 +00:00
|
|
|
case UninitializedMajorKey: return "<UninitializedMajorKey>Stub";
|
2008-07-03 15:10:15 +00:00
|
|
|
default:
|
2010-02-05 13:07:00 +00:00
|
|
|
if (!allow_unknown_keys) {
|
|
|
|
UNREACHABLE();
|
|
|
|
}
|
2008-07-03 15:10:15 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-05 09:52:11 +00:00
|
|
|
|
2013-07-05 09:26:22 +00:00
|
|
|
void CodeStub::PrintBaseName(StringStream* stream) {
|
|
|
|
stream->Add("%s", MajorName(MajorKey(), false));
|
|
|
|
}
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-10-03 11:13:20 +00:00
|
|
|
void CodeStub::PrintName(StringStream* stream) {
|
2013-07-05 09:26:22 +00:00
|
|
|
PrintBaseName(stream);
|
|
|
|
PrintState(stream);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-02 13:14:07 +00:00
|
|
|
// static
|
|
|
|
void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate) {
|
|
|
|
// Generate the uninitialized versions of the stub.
|
|
|
|
for (int op = Token::BIT_OR; op <= Token::MOD; ++op) {
|
|
|
|
for (int mode = NO_OVERWRITE; mode <= OVERWRITE_RIGHT; ++mode) {
|
|
|
|
BinaryOpICStub stub(static_cast<Token::Value>(op),
|
|
|
|
static_cast<OverwriteMode>(mode));
|
|
|
|
stub.GetCode(isolate);
|
2013-10-10 14:54:31 +00:00
|
|
|
}
|
2013-10-04 08:17:11 +00:00
|
|
|
}
|
|
|
|
|
2013-12-02 13:14:07 +00:00
|
|
|
// Generate special versions of the stub.
|
|
|
|
BinaryOpIC::State::GenerateAheadOfTime(isolate, &GenerateAheadOfTime);
|
2012-11-14 15:59:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-02 13:14:07 +00:00
|
|
|
void BinaryOpICStub::PrintState(StringStream* stream) {
|
|
|
|
state_.Print(stream);
|
2012-11-14 15:59:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-02 13:14:07 +00:00
|
|
|
// static
|
|
|
|
void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate,
|
|
|
|
const BinaryOpIC::State& state) {
|
|
|
|
BinaryOpICStub stub(state);
|
|
|
|
stub.GetCode(isolate);
|
2012-11-14 15:59:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-02 15:31:27 +00:00
|
|
|
// static
|
|
|
|
void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) {
|
|
|
|
// Generate special versions of the stub.
|
|
|
|
BinaryOpIC::State::GenerateAheadOfTime(isolate, &GenerateAheadOfTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BinaryOpICWithAllocationSiteStub::PrintState(StringStream* stream) {
|
|
|
|
state_.Print(stream);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(
|
|
|
|
Isolate* isolate, const BinaryOpIC::State& state) {
|
|
|
|
if (state.CouldCreateAllocationMementos()) {
|
|
|
|
BinaryOpICWithAllocationSiteStub stub(state);
|
|
|
|
stub.GetCode(isolate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-22 13:48:05 +00:00
|
|
|
void StringAddStub::PrintBaseName(StringStream* stream) {
|
|
|
|
stream->Add("StringAddStub");
|
2013-11-12 10:21:08 +00:00
|
|
|
if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) {
|
|
|
|
stream->Add("_CheckBoth");
|
|
|
|
} else if ((flags() & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) {
|
|
|
|
stream->Add("_CheckLeft");
|
|
|
|
} else if ((flags() & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) {
|
|
|
|
stream->Add("_CheckRight");
|
|
|
|
}
|
|
|
|
if (pretenure_flag() == TENURED) {
|
|
|
|
stream->Add("_Tenured");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-07 13:11:17 +00:00
|
|
|
InlineCacheState ICCompareStub::GetICState() {
|
|
|
|
CompareIC::State state = Max(left_, right_);
|
|
|
|
switch (state) {
|
|
|
|
case CompareIC::UNINITIALIZED:
|
|
|
|
return ::v8::internal::UNINITIALIZED;
|
|
|
|
case CompareIC::SMI:
|
|
|
|
case CompareIC::NUMBER:
|
|
|
|
case CompareIC::INTERNALIZED_STRING:
|
|
|
|
case CompareIC::STRING:
|
|
|
|
case CompareIC::UNIQUE_NAME:
|
|
|
|
case CompareIC::OBJECT:
|
|
|
|
case CompareIC::KNOWN_OBJECT:
|
|
|
|
return MONOMORPHIC;
|
|
|
|
case CompareIC::GENERIC:
|
|
|
|
return ::v8::internal::GENERIC;
|
|
|
|
}
|
|
|
|
UNREACHABLE();
|
|
|
|
return ::v8::internal::UNINITIALIZED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-12-09 09:26:14 +00:00
|
|
|
void ICCompareStub::AddToSpecialCache(Handle<Code> new_object) {
|
|
|
|
ASSERT(*known_map_ != NULL);
|
|
|
|
Isolate* isolate = new_object->GetIsolate();
|
|
|
|
Factory* factory = isolate->factory();
|
|
|
|
return Map::UpdateCodeCache(known_map_,
|
2012-08-15 15:08:42 +00:00
|
|
|
strict() ?
|
2013-02-28 17:03:34 +00:00
|
|
|
factory->strict_compare_ic_string() :
|
|
|
|
factory->compare_ic_string(),
|
2011-12-09 09:26:14 +00:00
|
|
|
new_object);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-11-22 07:58:59 +00:00
|
|
|
bool ICCompareStub::FindCodeInSpecialCache(Code** code_out, Isolate* isolate) {
|
2011-12-09 09:26:14 +00:00
|
|
|
Factory* factory = isolate->factory();
|
|
|
|
Code::Flags flags = Code::ComputeFlags(
|
2013-04-18 09:50:46 +00:00
|
|
|
GetCodeKind(),
|
2011-12-09 09:26:14 +00:00
|
|
|
UNINITIALIZED);
|
2012-08-15 15:08:42 +00:00
|
|
|
ASSERT(op_ == Token::EQ || op_ == Token::EQ_STRICT);
|
2013-02-28 17:03:34 +00:00
|
|
|
Handle<Object> probe(
|
|
|
|
known_map_->FindInCodeCache(
|
|
|
|
strict() ?
|
|
|
|
*factory->strict_compare_ic_string() :
|
|
|
|
*factory->compare_ic_string(),
|
|
|
|
flags),
|
|
|
|
isolate);
|
2011-12-09 09:26:14 +00:00
|
|
|
if (probe->IsCode()) {
|
|
|
|
*code_out = Code::cast(*probe);
|
2012-11-14 15:59:45 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
Token::Value cached_op;
|
|
|
|
ICCompareStub::DecodeMinorKey((*code_out)->stub_info(), NULL, NULL, NULL,
|
|
|
|
&cached_op);
|
|
|
|
ASSERT(op_ == cached_op);
|
|
|
|
#endif
|
2011-12-09 09:26:14 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-07 11:31:57 +00:00
|
|
|
int ICCompareStub::MinorKey() {
|
2012-11-14 15:59:45 +00:00
|
|
|
return OpField::encode(op_ - Token::EQ) |
|
|
|
|
LeftStateField::encode(left_) |
|
|
|
|
RightStateField::encode(right_) |
|
|
|
|
HandlerStateField::encode(state_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ICCompareStub::DecodeMinorKey(int minor_key,
|
|
|
|
CompareIC::State* left_state,
|
|
|
|
CompareIC::State* right_state,
|
|
|
|
CompareIC::State* handler_state,
|
|
|
|
Token::Value* op) {
|
|
|
|
if (left_state) {
|
|
|
|
*left_state =
|
|
|
|
static_cast<CompareIC::State>(LeftStateField::decode(minor_key));
|
|
|
|
}
|
|
|
|
if (right_state) {
|
|
|
|
*right_state =
|
|
|
|
static_cast<CompareIC::State>(RightStateField::decode(minor_key));
|
|
|
|
}
|
|
|
|
if (handler_state) {
|
|
|
|
*handler_state =
|
|
|
|
static_cast<CompareIC::State>(HandlerStateField::decode(minor_key));
|
|
|
|
}
|
|
|
|
if (op) {
|
|
|
|
*op = static_cast<Token::Value>(OpField::decode(minor_key) + Token::EQ);
|
|
|
|
}
|
2010-12-07 11:31:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ICCompareStub::Generate(MacroAssembler* masm) {
|
|
|
|
switch (state_) {
|
|
|
|
case CompareIC::UNINITIALIZED:
|
|
|
|
GenerateMiss(masm);
|
|
|
|
break;
|
2012-11-14 15:59:45 +00:00
|
|
|
case CompareIC::SMI:
|
2010-12-07 11:31:57 +00:00
|
|
|
GenerateSmis(masm);
|
|
|
|
break;
|
2013-02-28 14:43:57 +00:00
|
|
|
case CompareIC::NUMBER:
|
|
|
|
GenerateNumbers(masm);
|
2010-12-07 11:31:57 +00:00
|
|
|
break;
|
2012-11-14 15:59:45 +00:00
|
|
|
case CompareIC::STRING:
|
2011-05-04 18:30:37 +00:00
|
|
|
GenerateStrings(masm);
|
|
|
|
break;
|
2013-02-28 17:03:34 +00:00
|
|
|
case CompareIC::INTERNALIZED_STRING:
|
|
|
|
GenerateInternalizedStrings(masm);
|
2011-05-09 13:30:04 +00:00
|
|
|
break;
|
2013-03-01 13:28:55 +00:00
|
|
|
case CompareIC::UNIQUE_NAME:
|
|
|
|
GenerateUniqueNames(masm);
|
|
|
|
break;
|
2012-11-14 15:59:45 +00:00
|
|
|
case CompareIC::OBJECT:
|
2010-12-07 11:31:57 +00:00
|
|
|
GenerateObjects(masm);
|
|
|
|
break;
|
2013-02-28 14:43:57 +00:00
|
|
|
case CompareIC::KNOWN_OBJECT:
|
2011-12-09 09:26:14 +00:00
|
|
|
ASSERT(*known_map_ != NULL);
|
|
|
|
GenerateKnownObjects(masm);
|
|
|
|
break;
|
2012-11-14 15:59:45 +00:00
|
|
|
case CompareIC::GENERIC:
|
|
|
|
GenerateGeneric(masm);
|
|
|
|
break;
|
2010-12-07 11:31:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-05 09:26:22 +00:00
|
|
|
void CompareNilICStub::UpdateStatus(Handle<Object> object) {
|
2013-07-11 17:20:57 +00:00
|
|
|
ASSERT(!state_.Contains(GENERIC));
|
2013-07-05 09:26:22 +00:00
|
|
|
State old_state(state_);
|
2013-06-10 15:47:23 +00:00
|
|
|
if (object->IsNull()) {
|
2013-06-12 17:20:37 +00:00
|
|
|
state_.Add(NULL_TYPE);
|
2013-06-10 15:47:23 +00:00
|
|
|
} else if (object->IsUndefined()) {
|
2013-06-12 17:20:37 +00:00
|
|
|
state_.Add(UNDEFINED);
|
2013-06-10 15:47:23 +00:00
|
|
|
} else if (object->IsUndetectableObject() ||
|
|
|
|
object->IsOddball() ||
|
|
|
|
!object->IsHeapObject()) {
|
2013-07-11 17:20:57 +00:00
|
|
|
state_.RemoveAll();
|
|
|
|
state_.Add(GENERIC);
|
2013-06-10 15:47:23 +00:00
|
|
|
} else if (IsMonomorphic()) {
|
2013-07-11 17:20:57 +00:00
|
|
|
state_.RemoveAll();
|
|
|
|
state_.Add(GENERIC);
|
2013-04-24 11:32:17 +00:00
|
|
|
} else {
|
2013-06-12 17:20:37 +00:00
|
|
|
state_.Add(MONOMORPHIC_MAP);
|
2013-04-24 11:32:17 +00:00
|
|
|
}
|
2013-07-05 09:26:22 +00:00
|
|
|
TraceTransition(old_state, state_);
|
2013-05-16 10:59:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-05 09:26:22 +00:00
|
|
|
template<class StateType>
|
|
|
|
void HydrogenCodeStub::TraceTransition(StateType from, StateType to) {
|
2013-08-07 13:33:41 +00:00
|
|
|
// Note: Although a no-op transition is semantically OK, it is hinting at a
|
|
|
|
// bug somewhere in our state transition machinery.
|
|
|
|
ASSERT(from != to);
|
2013-05-24 15:20:48 +00:00
|
|
|
if (!FLAG_trace_ic) return;
|
|
|
|
char buffer[100];
|
|
|
|
NoAllocationStringAllocator allocator(buffer,
|
|
|
|
static_cast<unsigned>(sizeof(buffer)));
|
|
|
|
StringStream stream(&allocator);
|
2013-07-05 09:26:22 +00:00
|
|
|
stream.Add("[");
|
|
|
|
PrintBaseName(&stream);
|
|
|
|
stream.Add(": ");
|
|
|
|
from.Print(&stream);
|
2013-05-24 15:20:48 +00:00
|
|
|
stream.Add("=>");
|
|
|
|
to.Print(&stream);
|
|
|
|
stream.Add("]\n");
|
|
|
|
stream.OutputToStdOut();
|
|
|
|
}
|
|
|
|
|
2013-07-05 09:52:11 +00:00
|
|
|
|
2013-07-05 09:26:22 +00:00
|
|
|
void CompareNilICStub::PrintBaseName(StringStream* stream) {
|
|
|
|
CodeStub::PrintBaseName(stream);
|
|
|
|
stream->Add((nil_value_ == kNullValue) ? "(NullValue)":
|
|
|
|
"(UndefinedValue)");
|
|
|
|
}
|
2013-05-24 15:20:48 +00:00
|
|
|
|
2013-07-05 09:52:11 +00:00
|
|
|
|
2013-07-05 09:26:22 +00:00
|
|
|
void CompareNilICStub::PrintState(StringStream* stream) {
|
2013-06-12 17:20:37 +00:00
|
|
|
state_.Print(stream);
|
2013-05-16 10:59:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-12 17:20:37 +00:00
|
|
|
void CompareNilICStub::State::Print(StringStream* stream) const {
|
2013-05-16 10:59:17 +00:00
|
|
|
stream->Add("(");
|
|
|
|
SimpleListPrinter printer(stream);
|
|
|
|
if (IsEmpty()) printer.Add("None");
|
|
|
|
if (Contains(UNDEFINED)) printer.Add("Undefined");
|
|
|
|
if (Contains(NULL_TYPE)) printer.Add("Null");
|
|
|
|
if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap");
|
2013-06-12 17:20:37 +00:00
|
|
|
if (Contains(GENERIC)) printer.Add("Generic");
|
2013-05-16 10:59:17 +00:00
|
|
|
stream->Add(")");
|
2013-04-24 11:32:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-21 16:22:52 +00:00
|
|
|
Type* CompareNilICStub::GetType(Zone* zone, Handle<Map> map) {
|
2013-07-11 17:20:57 +00:00
|
|
|
if (state_.Contains(CompareNilICStub::GENERIC)) {
|
2014-01-21 16:22:52 +00:00
|
|
|
return Type::Any(zone);
|
2013-06-12 17:20:37 +00:00
|
|
|
}
|
|
|
|
|
2014-01-21 16:22:52 +00:00
|
|
|
Type* result = Type::None(zone);
|
2013-07-11 17:20:57 +00:00
|
|
|
if (state_.Contains(CompareNilICStub::UNDEFINED)) {
|
2014-01-21 16:22:52 +00:00
|
|
|
result = Type::Union(result, Type::Undefined(zone), zone);
|
2013-06-12 17:20:37 +00:00
|
|
|
}
|
2013-07-11 17:20:57 +00:00
|
|
|
if (state_.Contains(CompareNilICStub::NULL_TYPE)) {
|
2014-01-21 16:22:52 +00:00
|
|
|
result = Type::Union(result, Type::Null(zone), zone);
|
2013-06-12 17:20:37 +00:00
|
|
|
}
|
2013-07-11 17:20:57 +00:00
|
|
|
if (state_.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
|
2014-01-21 16:22:52 +00:00
|
|
|
Type* type =
|
|
|
|
map.is_null() ? Type::Detectable(zone) : Type::Class(map, zone);
|
|
|
|
result = Type::Union(result, type, zone);
|
2013-06-12 17:20:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-21 16:22:52 +00:00
|
|
|
Type* CompareNilICStub::GetInputType(Zone* zone, Handle<Map> map) {
|
|
|
|
Type* output_type = GetType(zone, map);
|
|
|
|
Type* nil_type =
|
|
|
|
nil_value_ == kNullValue ? Type::Null(zone) : Type::Undefined(zone);
|
|
|
|
return Type::Union(output_type, nil_type, zone);
|
2013-07-11 17:20:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-07-13 11:08:25 +00:00
|
|
|
void InstanceofStub::PrintName(StringStream* stream) {
|
2011-01-05 12:01:53 +00:00
|
|
|
const char* args = "";
|
|
|
|
if (HasArgsInRegisters()) {
|
|
|
|
args = "_REGS";
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* inline_check = "";
|
|
|
|
if (HasCallSiteInlineCheck()) {
|
|
|
|
inline_check = "_INLINE";
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* return_true_false_object = "";
|
|
|
|
if (ReturnTrueFalseObject()) {
|
|
|
|
return_true_false_object = "_TRUEFALSE";
|
|
|
|
}
|
|
|
|
|
2011-07-13 11:08:25 +00:00
|
|
|
stream->Add("InstanceofStub%s%s%s",
|
|
|
|
args,
|
|
|
|
inline_check,
|
|
|
|
return_true_false_object);
|
2011-01-05 12:01:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-11 13:48:14 +00:00
|
|
|
void JSEntryStub::FinishCode(Handle<Code> code) {
|
|
|
|
Handle<FixedArray> handler_table =
|
|
|
|
code->GetIsolate()->factory()->NewFixedArray(1, TENURED);
|
|
|
|
handler_table->set(0, Smi::FromInt(handler_offset_));
|
|
|
|
code->set_handler_table(*handler_table);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-15 17:53:35 +00:00
|
|
|
void KeyedLoadDictionaryElementPlatformStub::Generate(
|
|
|
|
MacroAssembler* masm) {
|
2012-12-18 16:25:45 +00:00
|
|
|
KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm);
|
2011-05-18 13:17:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-08 10:02:16 +00:00
|
|
|
void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) {
|
|
|
|
CreateAllocationSiteStub stub;
|
2013-12-02 09:46:35 +00:00
|
|
|
stub.GetCode(isolate);
|
2013-07-08 10:02:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-07-08 10:46:10 +00:00
|
|
|
void KeyedStoreElementStub::Generate(MacroAssembler* masm) {
|
|
|
|
switch (elements_kind_) {
|
2011-09-09 09:35:57 +00:00
|
|
|
case FAST_ELEMENTS:
|
2012-05-23 14:24:29 +00:00
|
|
|
case FAST_HOLEY_ELEMENTS:
|
|
|
|
case FAST_SMI_ELEMENTS:
|
2013-08-19 22:12:46 +00:00
|
|
|
case FAST_HOLEY_SMI_ELEMENTS:
|
2011-09-09 09:35:57 +00:00
|
|
|
case FAST_DOUBLE_ELEMENTS:
|
2012-05-23 14:24:29 +00:00
|
|
|
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
2014-01-24 16:01:15 +00:00
|
|
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
|
|
|
case EXTERNAL_##TYPE##_ELEMENTS: \
|
|
|
|
case TYPE##_ELEMENTS:
|
|
|
|
|
|
|
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
|
|
|
#undef TYPED_ARRAY_CASE
|
2013-08-19 22:12:46 +00:00
|
|
|
UNREACHABLE();
|
2011-07-08 10:46:10 +00:00
|
|
|
break;
|
2011-09-09 09:35:57 +00:00
|
|
|
case DICTIONARY_ELEMENTS:
|
2011-07-08 10:46:10 +00:00
|
|
|
KeyedStoreStubCompiler::GenerateStoreDictionaryElement(masm);
|
|
|
|
break;
|
2011-09-09 09:35:57 +00:00
|
|
|
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
2011-07-08 10:46:10 +00:00
|
|
|
UNREACHABLE();
|
|
|
|
break;
|
|
|
|
}
|
2011-05-18 13:17:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-07-13 11:08:25 +00:00
|
|
|
void ArgumentsAccessStub::PrintName(StringStream* stream) {
|
2011-09-27 11:42:02 +00:00
|
|
|
stream->Add("ArgumentsAccessStub_");
|
2011-07-13 11:08:25 +00:00
|
|
|
switch (type_) {
|
2011-09-27 11:42:02 +00:00
|
|
|
case READ_ELEMENT: stream->Add("ReadElement"); break;
|
|
|
|
case NEW_NON_STRICT_FAST: stream->Add("NewNonStrictFast"); break;
|
|
|
|
case NEW_NON_STRICT_SLOW: stream->Add("NewNonStrictSlow"); break;
|
|
|
|
case NEW_STRICT: stream->Add("NewStrict"); break;
|
2011-07-13 11:08:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CallFunctionStub::PrintName(StringStream* stream) {
|
2011-09-27 11:42:02 +00:00
|
|
|
stream->Add("CallFunctionStub_Args%d", argc_);
|
|
|
|
if (RecordCallTarget()) stream->Add("_Recording");
|
2011-07-13 11:08:25 +00:00
|
|
|
}
|
|
|
|
|
2011-07-21 13:51:04 +00:00
|
|
|
|
2012-01-27 13:03:19 +00:00
|
|
|
void CallConstructStub::PrintName(StringStream* stream) {
|
|
|
|
stream->Add("CallConstructStub");
|
|
|
|
if (RecordCallTarget()) stream->Add("_Recording");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-18 22:51:23 +00:00
|
|
|
void ArrayConstructorStub::PrintName(StringStream* stream) {
|
|
|
|
stream->Add("ArrayConstructorStub");
|
|
|
|
switch (argument_count_) {
|
|
|
|
case ANY: stream->Add("_Any"); break;
|
|
|
|
case NONE: stream->Add("_None"); break;
|
|
|
|
case ONE: stream->Add("_One"); break;
|
|
|
|
case MORE_THAN_ONE: stream->Add("_More_Than_One"); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ArrayConstructorStubBase::BasePrintName(const char* name,
|
|
|
|
StringStream* stream) {
|
|
|
|
stream->Add(name);
|
|
|
|
stream->Add("_");
|
|
|
|
stream->Add(ElementsKindToString(elements_kind()));
|
|
|
|
if (override_mode() == DISABLE_ALLOCATION_SITES) {
|
|
|
|
stream->Add("_DISABLE_ALLOCATION_SITES");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-05 09:26:22 +00:00
|
|
|
bool ToBooleanStub::UpdateStatus(Handle<Object> object) {
|
2013-05-29 14:49:28 +00:00
|
|
|
Types old_types(types_);
|
2013-07-05 09:26:22 +00:00
|
|
|
bool to_boolean_value = types_.UpdateStatus(object);
|
|
|
|
TraceTransition(old_types, types_);
|
2013-05-29 14:49:28 +00:00
|
|
|
return to_boolean_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-05 09:26:22 +00:00
|
|
|
void ToBooleanStub::PrintState(StringStream* stream) {
|
2011-07-21 13:51:04 +00:00
|
|
|
types_.Print(stream);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-07-28 13:33:51 +00:00
|
|
|
void ToBooleanStub::Types::Print(StringStream* stream) const {
|
2013-05-16 10:59:17 +00:00
|
|
|
stream->Add("(");
|
|
|
|
SimpleListPrinter printer(stream);
|
|
|
|
if (IsEmpty()) printer.Add("None");
|
|
|
|
if (Contains(UNDEFINED)) printer.Add("Undefined");
|
|
|
|
if (Contains(BOOLEAN)) printer.Add("Bool");
|
|
|
|
if (Contains(NULL_TYPE)) printer.Add("Null");
|
|
|
|
if (Contains(SMI)) printer.Add("Smi");
|
|
|
|
if (Contains(SPEC_OBJECT)) printer.Add("SpecObject");
|
|
|
|
if (Contains(STRING)) printer.Add("String");
|
|
|
|
if (Contains(SYMBOL)) printer.Add("Symbol");
|
|
|
|
if (Contains(HEAP_NUMBER)) printer.Add("HeapNumber");
|
|
|
|
stream->Add(")");
|
2011-07-21 13:51:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-05 09:26:22 +00:00
|
|
|
bool ToBooleanStub::Types::UpdateStatus(Handle<Object> object) {
|
2011-07-21 13:51:04 +00:00
|
|
|
if (object->IsUndefined()) {
|
|
|
|
Add(UNDEFINED);
|
|
|
|
return false;
|
|
|
|
} else if (object->IsBoolean()) {
|
|
|
|
Add(BOOLEAN);
|
|
|
|
return object->IsTrue();
|
|
|
|
} else if (object->IsNull()) {
|
|
|
|
Add(NULL_TYPE);
|
|
|
|
return false;
|
|
|
|
} else if (object->IsSmi()) {
|
|
|
|
Add(SMI);
|
|
|
|
return Smi::cast(*object)->value() != 0;
|
|
|
|
} else if (object->IsSpecObject()) {
|
|
|
|
Add(SPEC_OBJECT);
|
2011-07-22 12:42:40 +00:00
|
|
|
return !object->IsUndetectableObject();
|
2011-07-21 13:51:04 +00:00
|
|
|
} else if (object->IsString()) {
|
|
|
|
Add(STRING);
|
2011-07-22 12:42:40 +00:00
|
|
|
return !object->IsUndetectableObject() &&
|
|
|
|
String::cast(*object)->length() != 0;
|
2013-03-22 16:33:50 +00:00
|
|
|
} else if (object->IsSymbol()) {
|
|
|
|
Add(SYMBOL);
|
|
|
|
return true;
|
2011-07-21 13:51:04 +00:00
|
|
|
} else if (object->IsHeapNumber()) {
|
2011-08-11 07:22:16 +00:00
|
|
|
ASSERT(!object->IsUndetectableObject());
|
2011-07-21 13:51:04 +00:00
|
|
|
Add(HEAP_NUMBER);
|
|
|
|
double value = HeapNumber::cast(*object)->value();
|
2013-04-19 13:26:47 +00:00
|
|
|
return value != 0 && !std::isnan(value);
|
2011-07-21 13:51:04 +00:00
|
|
|
} else {
|
2011-08-11 07:22:16 +00:00
|
|
|
// We should never see an internal object at runtime here!
|
|
|
|
UNREACHABLE();
|
|
|
|
return true;
|
2011-07-21 13:51:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-07-28 13:33:51 +00:00
|
|
|
bool ToBooleanStub::Types::NeedsMap() const {
|
|
|
|
return Contains(ToBooleanStub::SPEC_OBJECT)
|
|
|
|
|| Contains(ToBooleanStub::STRING)
|
2013-03-22 16:33:50 +00:00
|
|
|
|| Contains(ToBooleanStub::SYMBOL)
|
2011-08-11 07:22:16 +00:00
|
|
|
|| Contains(ToBooleanStub::HEAP_NUMBER);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ToBooleanStub::Types::CanBeUndetectable() const {
|
|
|
|
return Contains(ToBooleanStub::SPEC_OBJECT)
|
|
|
|
|| Contains(ToBooleanStub::STRING);
|
2011-07-28 13:33:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-27 12:33:24 +00:00
|
|
|
void StubFailureTrampolineStub::GenerateAheadOfTime(Isolate* isolate) {
|
2013-04-04 17:55:43 +00:00
|
|
|
StubFailureTrampolineStub stub1(NOT_JS_FUNCTION_STUB_MODE);
|
|
|
|
StubFailureTrampolineStub stub2(JS_FUNCTION_STUB_MODE);
|
2013-12-02 09:46:35 +00:00
|
|
|
stub1.GetCode(isolate);
|
|
|
|
stub2.GetCode(isolate);
|
2013-02-05 08:09:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-17 15:18:15 +00:00
|
|
|
void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function,
|
2013-09-11 06:56:47 +00:00
|
|
|
intptr_t stack_pointer,
|
|
|
|
Isolate* isolate) {
|
|
|
|
FunctionEntryHook entry_hook = isolate->function_entry_hook();
|
2013-06-28 13:40:41 +00:00
|
|
|
ASSERT(entry_hook != NULL);
|
|
|
|
entry_hook(function, stack_pointer);
|
2012-07-17 15:18:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-25 16:00:32 +00:00
|
|
|
static void InstallDescriptor(Isolate* isolate, HydrogenCodeStub* stub) {
|
|
|
|
int major_key = stub->MajorKey();
|
|
|
|
CodeStubInterfaceDescriptor* descriptor =
|
|
|
|
isolate->code_stub_interface_descriptor(major_key);
|
|
|
|
if (!descriptor->initialized()) {
|
|
|
|
stub->InitializeInterfaceDescriptor(isolate, descriptor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ArrayConstructorStubBase::InstallDescriptors(Isolate* isolate) {
|
|
|
|
ArrayNoArgumentConstructorStub stub1(GetInitialFastElementsKind());
|
|
|
|
InstallDescriptor(isolate, &stub1);
|
|
|
|
ArraySingleArgumentConstructorStub stub2(GetInitialFastElementsKind());
|
|
|
|
InstallDescriptor(isolate, &stub2);
|
|
|
|
ArrayNArgumentsConstructorStub stub3(GetInitialFastElementsKind());
|
|
|
|
InstallDescriptor(isolate, &stub3);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-21 12:42:08 +00:00
|
|
|
void NumberToStringStub::InstallDescriptors(Isolate* isolate) {
|
|
|
|
NumberToStringStub stub;
|
|
|
|
InstallDescriptor(isolate, &stub);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-27 11:55:08 +00:00
|
|
|
void FastNewClosureStub::InstallDescriptors(Isolate* isolate) {
|
|
|
|
FastNewClosureStub stub(STRICT_MODE, false);
|
|
|
|
InstallDescriptor(isolate, &stub);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-23 08:36:22 +00:00
|
|
|
void FastNewContextStub::InstallDescriptors(Isolate* isolate) {
|
|
|
|
FastNewContextStub stub(FastNewContextStub::kMaximumSlots);
|
|
|
|
InstallDescriptor(isolate, &stub);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-21 11:19:32 +00:00
|
|
|
// static
|
|
|
|
void FastCloneShallowArrayStub::InstallDescriptors(Isolate* isolate) {
|
|
|
|
FastCloneShallowArrayStub stub(FastCloneShallowArrayStub::CLONE_ELEMENTS,
|
|
|
|
DONT_TRACK_ALLOCATION_SITE, 0);
|
|
|
|
InstallDescriptor(isolate, &stub);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-02 13:14:07 +00:00
|
|
|
// static
|
|
|
|
void BinaryOpICStub::InstallDescriptors(Isolate* isolate) {
|
|
|
|
BinaryOpICStub stub(Token::ADD, NO_OVERWRITE);
|
|
|
|
InstallDescriptor(isolate, &stub);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-09 13:22:18 +00:00
|
|
|
// static
|
|
|
|
void BinaryOpWithAllocationSiteStub::InstallDescriptors(Isolate* isolate) {
|
|
|
|
BinaryOpWithAllocationSiteStub stub(Token::ADD, NO_OVERWRITE);
|
|
|
|
InstallDescriptor(isolate, &stub);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-12 10:21:08 +00:00
|
|
|
// static
|
2014-01-22 13:48:05 +00:00
|
|
|
void StringAddStub::InstallDescriptors(Isolate* isolate) {
|
|
|
|
StringAddStub stub(STRING_ADD_CHECK_NONE, NOT_TENURED);
|
2013-11-12 10:21:08 +00:00
|
|
|
InstallDescriptor(isolate, &stub);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-29 13:10:35 +00:00
|
|
|
// static
|
|
|
|
void RegExpConstructResultStub::InstallDescriptors(Isolate* isolate) {
|
|
|
|
RegExpConstructResultStub stub;
|
|
|
|
InstallDescriptor(isolate, &stub);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-25 16:00:32 +00:00
|
|
|
ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
|
|
|
|
: argument_count_(ANY) {
|
|
|
|
ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate,
|
|
|
|
int argument_count) {
|
|
|
|
if (argument_count == 0) {
|
|
|
|
argument_count_ = NONE;
|
|
|
|
} else if (argument_count == 1) {
|
|
|
|
argument_count_ = ONE;
|
|
|
|
} else if (argument_count >= 2) {
|
|
|
|
argument_count_ = MORE_THAN_ONE;
|
|
|
|
} else {
|
|
|
|
UNREACHABLE();
|
|
|
|
}
|
|
|
|
ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-05 10:43:18 +00:00
|
|
|
void InternalArrayConstructorStubBase::InstallDescriptors(Isolate* isolate) {
|
|
|
|
InternalArrayNoArgumentConstructorStub stub1(FAST_ELEMENTS);
|
|
|
|
InstallDescriptor(isolate, &stub1);
|
|
|
|
InternalArraySingleArgumentConstructorStub stub2(FAST_ELEMENTS);
|
|
|
|
InstallDescriptor(isolate, &stub2);
|
|
|
|
InternalArrayNArgumentsConstructorStub stub3(FAST_ELEMENTS);
|
|
|
|
InstallDescriptor(isolate, &stub3);
|
|
|
|
}
|
|
|
|
|
|
|
|
InternalArrayConstructorStub::InternalArrayConstructorStub(
|
|
|
|
Isolate* isolate) {
|
|
|
|
InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
} } // namespace v8::internal
|