[iwyu] Remove illegal inline include from "macro-assembler.h"

R=clemensh@chromium.org

Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: I3df5d50f81909188ee0cb31d0f479aadeeabe20f
Reviewed-on: https://chromium-review.googlesource.com/662780
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47991}
This commit is contained in:
Michael Starzinger 2017-09-13 12:56:20 +02:00 committed by Commit Bot
parent 26d299755e
commit bc69f3450b
120 changed files with 831 additions and 747 deletions

View File

@ -919,6 +919,49 @@ void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(
stub2.GetCode();
}
RecordWriteStub::Mode RecordWriteStub::GetMode(Code* stub) {
Instr first_instruction = Assembler::instr_at(stub->instruction_start());
Instr second_instruction =
Assembler::instr_at(stub->instruction_start() + Assembler::kInstrSize);
if (Assembler::IsBranch(first_instruction)) {
return INCREMENTAL;
}
DCHECK(Assembler::IsTstImmediate(first_instruction));
if (Assembler::IsBranch(second_instruction)) {
return INCREMENTAL_COMPACTION;
}
DCHECK(Assembler::IsTstImmediate(second_instruction));
return STORE_BUFFER_ONLY;
}
void RecordWriteStub::Patch(Code* stub, Mode mode) {
MacroAssembler masm(stub->GetIsolate(), stub->instruction_start(),
stub->instruction_size(), CodeObjectRequired::kNo);
switch (mode) {
case STORE_BUFFER_ONLY:
DCHECK(GetMode(stub) == INCREMENTAL ||
GetMode(stub) == INCREMENTAL_COMPACTION);
PatchBranchIntoNop(&masm, 0);
PatchBranchIntoNop(&masm, Assembler::kInstrSize);
break;
case INCREMENTAL:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, 0);
break;
case INCREMENTAL_COMPACTION:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, Assembler::kInstrSize);
break;
}
DCHECK(GetMode(stub) == mode);
Assembler::FlushICache(stub->GetIsolate(), stub->instruction_start(),
2 * Assembler::kInstrSize);
}
// Takes the input in 3 registers: address_ value_ and object_. A pointer to
// the value has just been written into the object, now this stub makes sure

View File

@ -72,49 +72,9 @@ class RecordWriteStub: public PlatformCodeStub {
DCHECK(Assembler::IsBranch(masm->instr_at(pos)));
}
static Mode GetMode(Code* stub) {
Instr first_instruction = Assembler::instr_at(stub->instruction_start());
Instr second_instruction = Assembler::instr_at(stub->instruction_start() +
Assembler::kInstrSize);
static Mode GetMode(Code* stub);
if (Assembler::IsBranch(first_instruction)) {
return INCREMENTAL;
}
DCHECK(Assembler::IsTstImmediate(first_instruction));
if (Assembler::IsBranch(second_instruction)) {
return INCREMENTAL_COMPACTION;
}
DCHECK(Assembler::IsTstImmediate(second_instruction));
return STORE_BUFFER_ONLY;
}
static void Patch(Code* stub, Mode mode) {
MacroAssembler masm(stub->GetIsolate(), stub->instruction_start(),
stub->instruction_size(), CodeObjectRequired::kNo);
switch (mode) {
case STORE_BUFFER_ONLY:
DCHECK(GetMode(stub) == INCREMENTAL ||
GetMode(stub) == INCREMENTAL_COMPACTION);
PatchBranchIntoNop(&masm, 0);
PatchBranchIntoNop(&masm, Assembler::kInstrSize);
break;
case INCREMENTAL:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, 0);
break;
case INCREMENTAL_COMPACTION:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, Assembler::kInstrSize);
break;
}
DCHECK(GetMode(stub) == mode);
Assembler::FlushICache(stub->GetIsolate(), stub->instruction_start(),
2 * Assembler::kInstrSize);
}
static void Patch(Code* stub, Mode mode);
DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();

View File

@ -30,6 +30,15 @@ MacroAssembler::MacroAssembler(Isolate* isolate, void* buffer, int size,
CodeObjectRequired create_code_object)
: TurboAssembler(isolate, buffer, size, create_code_object) {}
TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size), isolate_(isolate) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ =
Handle<HeapObject>::New(isolate->heap()->undefined_value(), isolate);
}
}
int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion1,
Register exclusion2,

View File

@ -88,13 +88,7 @@ enum TargetAddressStorageMode {
class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size), isolate_(isolate) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ =
Handle<HeapObject>::New(isolate->heap()->undefined_value(), isolate);
}
}
CodeObjectRequired create_code_object);
void set_has_frame(bool value) { has_frame_ = value; }
bool has_frame() const { return has_frame_; }

View File

@ -27,68 +27,6 @@ void RelocInfo::apply(intptr_t delta) {
*p += delta; // Relocate entry.
}
inline CPURegister::RegisterType CPURegister::type() const { return reg_type_; }
inline RegList CPURegister::bit() const {
DCHECK(static_cast<size_t>(reg_code_) < (sizeof(RegList) * kBitsPerByte));
return IsValid() ? 1UL << reg_code_ : 0;
}
inline int CPURegister::SizeInBits() const {
DCHECK(IsValid());
return reg_size_;
}
inline int CPURegister::SizeInBytes() const {
DCHECK(IsValid());
DCHECK(SizeInBits() % 8 == 0);
return reg_size_ / 8;
}
inline bool CPURegister::Is8Bits() const {
DCHECK(IsValid());
return reg_size_ == 8;
}
inline bool CPURegister::Is16Bits() const {
DCHECK(IsValid());
return reg_size_ == 16;
}
inline bool CPURegister::Is32Bits() const {
DCHECK(IsValid());
return reg_size_ == 32;
}
inline bool CPURegister::Is64Bits() const {
DCHECK(IsValid());
return reg_size_ == 64;
}
inline bool CPURegister::Is128Bits() const {
DCHECK(IsValid());
return reg_size_ == 128;
}
inline bool CPURegister::IsValid() const { return reg_type_ != kNoRegister; }
inline bool CPURegister::IsNone() const { return reg_type_ == kNoRegister; }
inline bool CPURegister::Is(const CPURegister& other) const {
return Aliases(other) && (reg_size_ == other.reg_size_);
}
inline bool CPURegister::Aliases(const CPURegister& other) const {
return (reg_code_ == other.reg_code_) && (reg_type_ == other.reg_type_);
}
inline bool CPURegister::IsRegister() const { return reg_type_ == kRegister; }
inline bool CPURegister::IsVRegister() const { return reg_type_ == kVRegister; }
inline bool CPURegister::IsSameSizeAndType(const CPURegister& other) const {
return (reg_size_ == other.reg_size_) && (reg_type_ == other.reg_type_);

View File

@ -121,25 +121,54 @@ class CPURegister : public RegisterBase<CPURegister, kRegAfterLast> {
return CPURegister{code, size, type};
}
RegisterType type() const;
RegList bit() const;
int SizeInBits() const;
int SizeInBytes() const;
bool Is8Bits() const;
bool Is16Bits() const;
bool Is32Bits() const;
bool Is64Bits() const;
bool Is128Bits() const;
bool IsValid() const;
bool IsNone() const;
bool Is(const CPURegister& other) const;
bool Aliases(const CPURegister& other) const;
RegisterType type() const { return reg_type_; }
RegList bit() const {
DCHECK(static_cast<size_t>(reg_code_) < (sizeof(RegList) * kBitsPerByte));
return IsValid() ? 1UL << reg_code_ : 0;
}
int SizeInBits() const {
DCHECK(IsValid());
return reg_size_;
}
int SizeInBytes() const {
DCHECK(IsValid());
DCHECK(SizeInBits() % 8 == 0);
return reg_size_ / 8;
}
bool Is8Bits() const {
DCHECK(IsValid());
return reg_size_ == 8;
}
bool Is16Bits() const {
DCHECK(IsValid());
return reg_size_ == 16;
}
bool Is32Bits() const {
DCHECK(IsValid());
return reg_size_ == 32;
}
bool Is64Bits() const {
DCHECK(IsValid());
return reg_size_ == 64;
}
bool Is128Bits() const {
DCHECK(IsValid());
return reg_size_ == 128;
}
bool IsValid() const { return reg_type_ != kNoRegister; }
bool IsNone() const { return reg_type_ == kNoRegister; }
bool Is(const CPURegister& other) const {
return Aliases(other) && (reg_size_ == other.reg_size_);
}
bool Aliases(const CPURegister& other) const {
return (reg_code_ == other.reg_code_) && (reg_type_ == other.reg_type_);
}
bool IsZero() const;
bool IsSP() const;
bool IsRegister() const;
bool IsVRegister() const;
bool IsRegister() const { return reg_type_ == kRegister; }
bool IsVRegister() const { return reg_type_ == kVRegister; }
bool IsFPRegister() const { return IsS() || IsD(); }

View File

@ -891,6 +891,70 @@ RecordWriteStub::RegisterAllocation::RegisterAllocation(Register object,
saved_regs_.Remove(scratch2_);
}
RecordWriteStub::Mode RecordWriteStub::GetMode(Code* stub) {
// Find the mode depending on the first two instructions.
Instruction* instr1 =
reinterpret_cast<Instruction*>(stub->instruction_start());
Instruction* instr2 = instr1->following();
if (instr1->IsUncondBranchImm()) {
DCHECK(instr2->IsPCRelAddressing() && (instr2->Rd() == xzr.code()));
return INCREMENTAL;
}
DCHECK(instr1->IsPCRelAddressing() && (instr1->Rd() == xzr.code()));
if (instr2->IsUncondBranchImm()) {
return INCREMENTAL_COMPACTION;
}
DCHECK(instr2->IsPCRelAddressing());
return STORE_BUFFER_ONLY;
}
// We patch the two first instructions of the stub back and forth between an
// adr and branch when we start and stop incremental heap marking.
// The branch is
// b label
// The adr is
// adr xzr label
// so effectively a nop.
void RecordWriteStub::Patch(Code* stub, Mode mode) {
// We are going to patch the two first instructions of the stub.
PatchingAssembler patcher(stub->GetIsolate(), stub->instruction_start(), 2);
Instruction* instr1 = patcher.InstructionAt(0);
Instruction* instr2 = patcher.InstructionAt(kInstructionSize);
// Instructions must be either 'adr' or 'b'.
DCHECK(instr1->IsPCRelAddressing() || instr1->IsUncondBranchImm());
DCHECK(instr2->IsPCRelAddressing() || instr2->IsUncondBranchImm());
// Retrieve the offsets to the labels.
auto offset_to_incremental_noncompacting =
static_cast<int32_t>(instr1->ImmPCOffset());
auto offset_to_incremental_compacting =
static_cast<int32_t>(instr2->ImmPCOffset());
switch (mode) {
case STORE_BUFFER_ONLY:
DCHECK(GetMode(stub) == INCREMENTAL ||
GetMode(stub) == INCREMENTAL_COMPACTION);
patcher.adr(xzr, offset_to_incremental_noncompacting);
patcher.adr(xzr, offset_to_incremental_compacting);
break;
case INCREMENTAL:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
patcher.b(offset_to_incremental_noncompacting >> kInstructionSizeLog2);
patcher.adr(xzr, offset_to_incremental_compacting);
break;
case INCREMENTAL_COMPACTION:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
patcher.adr(xzr, offset_to_incremental_noncompacting);
patcher.b(offset_to_incremental_compacting >> kInstructionSizeLog2);
break;
}
DCHECK(GetMode(stub) == mode);
}
void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
// We need some extra registers for this stub, they have been allocated
// but we need to save them before using them.

View File

@ -68,69 +68,9 @@ class RecordWriteStub: public PlatformCodeStub {
bool SometimesSetsUpAFrame() override { return false; }
static Mode GetMode(Code* stub) {
// Find the mode depending on the first two instructions.
Instruction* instr1 =
reinterpret_cast<Instruction*>(stub->instruction_start());
Instruction* instr2 = instr1->following();
static Mode GetMode(Code* stub);
if (instr1->IsUncondBranchImm()) {
DCHECK(instr2->IsPCRelAddressing() && (instr2->Rd() == xzr.code()));
return INCREMENTAL;
}
DCHECK(instr1->IsPCRelAddressing() && (instr1->Rd() == xzr.code()));
if (instr2->IsUncondBranchImm()) {
return INCREMENTAL_COMPACTION;
}
DCHECK(instr2->IsPCRelAddressing());
return STORE_BUFFER_ONLY;
}
// We patch the two first instructions of the stub back and forth between an
// adr and branch when we start and stop incremental heap marking.
// The branch is
// b label
// The adr is
// adr xzr label
// so effectively a nop.
static void Patch(Code* stub, Mode mode) {
// We are going to patch the two first instructions of the stub.
PatchingAssembler patcher(stub->GetIsolate(), stub->instruction_start(), 2);
Instruction* instr1 = patcher.InstructionAt(0);
Instruction* instr2 = patcher.InstructionAt(kInstructionSize);
// Instructions must be either 'adr' or 'b'.
DCHECK(instr1->IsPCRelAddressing() || instr1->IsUncondBranchImm());
DCHECK(instr2->IsPCRelAddressing() || instr2->IsUncondBranchImm());
// Retrieve the offsets to the labels.
auto offset_to_incremental_noncompacting =
static_cast<int32_t>(instr1->ImmPCOffset());
auto offset_to_incremental_compacting =
static_cast<int32_t>(instr2->ImmPCOffset());
switch (mode) {
case STORE_BUFFER_ONLY:
DCHECK(GetMode(stub) == INCREMENTAL ||
GetMode(stub) == INCREMENTAL_COMPACTION);
patcher.adr(xzr, offset_to_incremental_noncompacting);
patcher.adr(xzr, offset_to_incremental_compacting);
break;
case INCREMENTAL:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
patcher.b(offset_to_incremental_noncompacting >> kInstructionSizeLog2);
patcher.adr(xzr, offset_to_incremental_compacting);
break;
case INCREMENTAL_COMPACTION:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
patcher.adr(xzr, offset_to_incremental_noncompacting);
patcher.b(offset_to_incremental_compacting >> kInstructionSizeLog2);
break;
}
DCHECK(GetMode(stub) == mode);
}
static void Patch(Code* stub, Mode mode);
DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();

View File

@ -34,6 +34,23 @@ CPURegList TurboAssembler::DefaultFPTmpList() {
return CPURegList(fp_scratch1, fp_scratch2);
}
TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size),
isolate_(isolate),
#if DEBUG
allow_macro_instructions_(true),
#endif
tmp_list_(DefaultTmpList()),
fptmp_list_(DefaultFPTmpList()),
sp_(jssp),
use_real_aborts_(true) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ =
Handle<HeapObject>::New(isolate->heap()->undefined_value(), isolate);
}
}
int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion1,
Register exclusion2,

View File

@ -184,21 +184,7 @@ enum PreShiftImmMode {
class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size),
isolate_(isolate),
#if DEBUG
allow_macro_instructions_(true),
#endif
tmp_list_(DefaultTmpList()),
fptmp_list_(DefaultFPTmpList()),
sp_(jssp),
use_real_aborts_(true) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ =
Handle<HeapObject>::New(isolate->heap()->undefined_value(), isolate);
}
}
CodeObjectRequired create_code_object);
// The Abort method should call a V8 runtime function, but the CallRuntime
// mechanism depends on CEntryStub. If use_real_aborts is false, Abort will

View File

@ -168,6 +168,30 @@ void AstConsString::Internalize(Isolate* isolate) {
set_string(tmp);
}
AstValue::AstValue(double n) : next_(nullptr) {
int int_value;
if (DoubleToSmiInteger(n, &int_value)) {
type_ = SMI;
smi_ = int_value;
} else {
type_ = NUMBER;
number_ = n;
}
}
bool AstValue::ToUint32(uint32_t* value) const {
if (IsSmi()) {
int num = smi_;
if (num < 0) return false;
*value = static_cast<uint32_t>(num);
return true;
}
if (IsHeapNumber()) {
return DoubleToUint32IfEqualToSelf(number_, value);
}
return false;
}
bool AstValue::IsPropertyName() const {
if (type_ == STRING) {
uint32_t index;
@ -242,6 +266,31 @@ void AstValue::Internalize(Isolate* isolate) {
}
}
AstStringConstants::AstStringConstants(Isolate* isolate, uint32_t hash_seed)
: zone_(isolate->allocator(), ZONE_NAME),
string_table_(AstRawString::Compare),
hash_seed_(hash_seed) {
DCHECK(ThreadId::Current().Equals(isolate->thread_id()));
#define F(name, str) \
{ \
const char* data = str; \
Vector<const uint8_t> literal(reinterpret_cast<const uint8_t*>(data), \
static_cast<int>(strlen(data))); \
uint32_t hash_field = StringHasher::HashSequentialString<uint8_t>( \
literal.start(), literal.length(), hash_seed_); \
name##_string_ = new (&zone_) AstRawString(true, literal, hash_field); \
/* The Handle returned by the factory is located on the roots */ \
/* array, not on the temporary HandleScope, so this is safe. */ \
name##_string_->set_string(isolate->factory()->name##_string()); \
base::HashMap::Entry* entry = \
string_table_.InsertNew(name##_string_, name##_string_->Hash()); \
DCHECK_NULL(entry->value); \
entry->value = reinterpret_cast<void*>(1); \
}
AST_STRING_CONSTANTS(F)
#undef F
}
AstRawString* AstValueFactory::GetOneByteStringInternal(
Vector<const uint8_t> literal) {
if (literal.length() == 1 && IsInRange(literal[0], 'a', 'z')) {

View File

@ -209,18 +209,7 @@ class AstValue : public ZoneObject {
return Smi::FromInt(smi_);
}
bool ToUint32(uint32_t* value) const {
if (IsSmi()) {
int num = smi_;
if (num < 0) return false;
*value = static_cast<uint32_t>(num);
return true;
}
if (IsHeapNumber()) {
return DoubleToUint32IfEqualToSelf(number_, value);
}
return false;
}
bool ToUint32(uint32_t* value) const;
bool EqualsString(const AstRawString* string) const {
return type_ == STRING && string_ == string;
@ -274,16 +263,7 @@ class AstValue : public ZoneObject {
symbol_ = symbol;
}
explicit AstValue(double n) : next_(nullptr) {
int int_value;
if (DoubleToSmiInteger(n, &int_value)) {
type_ = SMI;
smi_ = int_value;
} else {
type_ = NUMBER;
number_ = n;
}
}
explicit AstValue(double n);
AstValue(Type t, int i) : type_(t), next_(nullptr) {
DCHECK(type_ == SMI);
@ -316,7 +296,7 @@ class AstValue : public ZoneObject {
};
// For generating constants.
#define STRING_CONSTANTS(F) \
#define AST_STRING_CONSTANTS(F) \
F(anonymous_function, "(anonymous function)") \
F(arguments, "arguments") \
F(async, "async") \
@ -361,34 +341,11 @@ class AstValue : public ZoneObject {
class AstStringConstants final {
public:
AstStringConstants(Isolate* isolate, uint32_t hash_seed)
: zone_(isolate->allocator(), ZONE_NAME),
string_table_(AstRawString::Compare),
hash_seed_(hash_seed) {
DCHECK(ThreadId::Current().Equals(isolate->thread_id()));
#define F(name, str) \
{ \
const char* data = str; \
Vector<const uint8_t> literal(reinterpret_cast<const uint8_t*>(data), \
static_cast<int>(strlen(data))); \
uint32_t hash_field = StringHasher::HashSequentialString<uint8_t>( \
literal.start(), literal.length(), hash_seed_); \
name##_string_ = new (&zone_) AstRawString(true, literal, hash_field); \
/* The Handle returned by the factory is located on the roots */ \
/* array, not on the temporary HandleScope, so this is safe. */ \
name##_string_->set_string(isolate->factory()->name##_string()); \
base::HashMap::Entry* entry = \
string_table_.InsertNew(name##_string_, name##_string_->Hash()); \
DCHECK_NULL(entry->value); \
entry->value = reinterpret_cast<void*>(1); \
}
STRING_CONSTANTS(F)
#undef F
}
AstStringConstants(Isolate* isolate, uint32_t hash_seed);
#define F(name, str) \
const AstRawString* name##_string() const { return name##_string_; }
STRING_CONSTANTS(F)
AST_STRING_CONSTANTS(F)
#undef F
uint32_t hash_seed() const { return hash_seed_; }
@ -402,7 +359,7 @@ class AstStringConstants final {
uint32_t hash_seed_;
#define F(name, str) AstRawString* name##_string_;
STRING_CONSTANTS(F)
AST_STRING_CONSTANTS(F)
#undef F
DISALLOW_COPY_AND_ASSIGN(AstStringConstants);
@ -464,7 +421,7 @@ class AstValueFactory {
const AstRawString* name##_string() const { \
return string_constants_->name##_string(); \
}
STRING_CONSTANTS(F)
AST_STRING_CONSTANTS(F)
#undef F
const AstConsString* empty_cons_string() const { return empty_cons_string_; }
@ -544,7 +501,6 @@ class AstValueFactory {
} // namespace internal
} // namespace v8
#undef STRING_CONSTANTS
#undef OTHER_CONSTANTS
#endif // V8_AST_AST_VALUE_FACTORY_H_

View File

@ -283,6 +283,9 @@ bool FunctionLiteral::AllowsLazyCompilation() {
return scope()->AllowsLazyCompilation();
}
Handle<String> FunctionLiteral::name(Isolate* isolate) const {
return raw_name_ ? raw_name_->string() : isolate->factory()->empty_string();
}
int FunctionLiteral::start_position() const {
return scope()->start_position();
@ -643,6 +646,12 @@ bool ObjectLiteral::IsFastCloningSupported() const {
ConstructorBuiltins::kMaximumClonedShallowObjectProperties;
}
bool ArrayLiteral::is_empty() const {
DCHECK(is_initialized());
return values()->is_empty() &&
(constant_elements().is_null() || constant_elements()->is_empty());
}
int ArrayLiteral::InitDepthAndFlags() {
DCHECK_LT(first_spread_index_, 0);
if (is_initialized()) return depth();

View File

@ -1039,11 +1039,6 @@ class Literal final : public Expression {
// as array indices).
bool IsPropertyName() const { return value_->IsPropertyName(); }
Handle<String> AsPropertyName() {
DCHECK(IsPropertyName());
return Handle<String>::cast(value());
}
const AstRawString* AsRawPropertyName() {
DCHECK(IsPropertyName());
return value_->AsString();
@ -1437,11 +1432,7 @@ class ArrayLiteral final : public AggregateLiteral {
ZoneList<Expression*>* values() const { return values_; }
bool is_empty() const {
DCHECK(is_initialized());
return values()->is_empty() &&
(constant_elements().is_null() || constant_elements()->is_empty());
}
bool is_empty() const;
// Populate the depth field and flags, returns the depth.
int InitDepthAndFlags();
@ -2301,9 +2292,7 @@ class FunctionLiteral final : public Expression {
MaybeHandle<String> name() const {
return raw_name_ ? raw_name_->string() : MaybeHandle<String>();
}
Handle<String> name(Isolate* isolate) const {
return raw_name_ ? raw_name_->string() : isolate->factory()->empty_string();
}
Handle<String> name(Isolate* isolate) const;
bool has_shared_name() const { return raw_name_ != nullptr; }
const AstConsString* raw_name() const { return raw_name_; }
void set_raw_name(const AstConsString* name) { raw_name_ = name; }

View File

@ -31,6 +31,41 @@
namespace v8 {
namespace internal {
void SourceCodeCache::Initialize(Isolate* isolate, bool create_heap_objects) {
cache_ = create_heap_objects ? isolate->heap()->empty_fixed_array() : NULL;
}
bool SourceCodeCache::Lookup(Vector<const char> name,
Handle<SharedFunctionInfo>* handle) {
for (int i = 0; i < cache_->length(); i += 2) {
SeqOneByteString* str = SeqOneByteString::cast(cache_->get(i));
if (str->IsUtf8EqualTo(name)) {
*handle = Handle<SharedFunctionInfo>(
SharedFunctionInfo::cast(cache_->get(i + 1)));
return true;
}
}
return false;
}
void SourceCodeCache::Add(Vector<const char> name,
Handle<SharedFunctionInfo> shared) {
Isolate* isolate = shared->GetIsolate();
Factory* factory = isolate->factory();
HandleScope scope(isolate);
int length = cache_->length();
Handle<FixedArray> new_array = factory->NewFixedArray(length + 2, TENURED);
cache_->CopyTo(0, *new_array, 0, cache_->length());
cache_ = *new_array;
Handle<String> str =
factory->NewStringFromOneByte(Vector<const uint8_t>::cast(name), TENURED)
.ToHandleChecked();
DCHECK(!str.is_null());
cache_->set(length, *str);
cache_->set(length + 1, *shared);
Script::cast(shared->script())->set_type(type_);
}
Bootstrapper::Bootstrapper(Isolate* isolate)
: isolate_(isolate),
nesting_(0),

View File

@ -22,44 +22,16 @@ class SourceCodeCache final BASE_EMBEDDED {
public:
explicit SourceCodeCache(Script::Type type): type_(type), cache_(NULL) { }
void Initialize(Isolate* isolate, bool create_heap_objects) {
cache_ = create_heap_objects ? isolate->heap()->empty_fixed_array() : NULL;
}
void Initialize(Isolate* isolate, bool create_heap_objects);
void Iterate(RootVisitor* v) {
v->VisitRootPointer(Root::kExtensions,
bit_cast<Object**, FixedArray**>(&cache_));
}
bool Lookup(Vector<const char> name, Handle<SharedFunctionInfo>* handle) {
for (int i = 0; i < cache_->length(); i+=2) {
SeqOneByteString* str = SeqOneByteString::cast(cache_->get(i));
if (str->IsUtf8EqualTo(name)) {
*handle = Handle<SharedFunctionInfo>(
SharedFunctionInfo::cast(cache_->get(i + 1)));
return true;
}
}
return false;
}
bool Lookup(Vector<const char> name, Handle<SharedFunctionInfo>* handle);
void Add(Vector<const char> name, Handle<SharedFunctionInfo> shared) {
Isolate* isolate = shared->GetIsolate();
Factory* factory = isolate->factory();
HandleScope scope(isolate);
int length = cache_->length();
Handle<FixedArray> new_array = factory->NewFixedArray(length + 2, TENURED);
cache_->CopyTo(0, *new_array, 0, cache_->length());
cache_ = *new_array;
Handle<String> str =
factory
->NewStringFromOneByte(Vector<const uint8_t>::cast(name), TENURED)
.ToHandleChecked();
DCHECK(!str.is_null());
cache_->set(length, *str);
cache_->set(length + 1, *shared);
Script::cast(shared->script())->set_type(type_);
}
void Add(Vector<const char> name, Handle<SharedFunctionInfo> shared);
private:
Script::Type type_;

View File

@ -6,6 +6,7 @@
#include "src/builtins/builtins-utils-gen.h"
#include "src/builtins/builtins.h"
#include "src/code-stub-assembler.h"
#include "src/factory-inl.h"
#include "src/frame-constants.h"
namespace v8 {

View File

@ -3,7 +3,10 @@
// found in the LICENSE file.
#include "src/builtins/builtins-async-gen.h"
#include "src/builtins/builtins-utils-gen.h"
#include "src/factory-inl.h"
#include "src/objects/shared-function-info.h"
namespace v8 {
namespace internal {

View File

@ -7,8 +7,10 @@
#include "src/builtins/builtins-utils-gen.h"
#include "src/builtins/builtins.h"
#include "src/globals.h"
#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/macro-assembler.h"
#include "src/objects/arguments.h"
namespace v8 {
namespace internal {

View File

@ -6,6 +6,7 @@
#include "src/builtins/builtins-iterator-gen.h"
#include "src/builtins/builtins-utils-gen.h"
#include "src/code-stub-assembler.h"
#include "src/factory-inl.h"
#include "src/objects/hash-table.h"
namespace v8 {

View File

@ -6,6 +6,7 @@
#include "src/builtins/builtins.h"
#include "src/code-stub-assembler.h"
#include "src/frame-constants.h"
#include "src/list-inl.h" // TODO(mstarzinger): Temporary cycle breaker.
namespace v8 {
namespace internal {

View File

@ -5,7 +5,9 @@
#include "src/builtins/builtins-utils-gen.h"
#include "src/builtins/builtins.h"
#include "src/code-stub-assembler.h"
#include "src/heap/heap-inl.h"
#include "src/macro-assembler.h"
#include "src/objects/shared-function-info.h"
#include "src/runtime/runtime.h"
namespace v8 {

View File

@ -8,6 +8,7 @@
#include "src/builtins/builtins-utils-gen.h"
#include "src/code-stub-assembler.h"
#include "src/list-inl.h" // TODO(mstarzinger): Temporary cycle breaker.
namespace v8 {
namespace internal {

View File

@ -4,6 +4,8 @@
#include "src/builtins/builtins-iterator-gen.h"
#include "src/factory-inl.h"
namespace v8 {
namespace internal {

View File

@ -6,6 +6,7 @@
#include "src/builtins/builtins.h"
#include "src/code-factory.h"
#include "src/code-stub-assembler.h"
#include "src/list-inl.h" // TODO(mstarzinger): Temporary cycle breaker.
namespace v8 {
namespace internal {

View File

@ -5,6 +5,8 @@
#include "src/builtins/builtins-utils-gen.h"
#include "src/builtins/builtins.h"
#include "src/code-stub-assembler.h"
#include "src/factory-inl.h"
#include "src/objects/shared-function-info.h"
namespace v8 {
namespace internal {

View File

@ -9,6 +9,8 @@
#include "src/builtins/builtins.h"
#include "src/code-factory.h"
#include "src/code-stub-assembler.h"
#include "src/counters.h"
#include "src/factory-inl.h"
#include "src/objects/regexp-match-info.h"
#include "src/regexp/regexp-macro-assembler.h"

View File

@ -8,6 +8,7 @@
#include "src/builtins/builtins-utils-gen.h"
#include "src/builtins/builtins.h"
#include "src/code-factory.h"
#include "src/factory-inl.h"
#include "src/objects.h"
namespace v8 {

View File

@ -5,6 +5,7 @@
#include "src/builtins/builtins-utils-gen.h"
#include "src/builtins/builtins.h"
#include "src/code-stub-assembler.h"
#include "src/handles-inl.h"
namespace v8 {
namespace internal {

View File

@ -6,9 +6,11 @@
#include "src/code-factory.h"
#include "src/codegen.h"
#include "src/debug/debug.h"
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/objects-inl.h"
namespace v8 {
namespace internal {

View File

@ -5,10 +5,12 @@
#if V8_TARGET_ARCH_MIPS
#include "src/codegen.h"
#include "src/counters.h"
#include "src/debug/debug.h"
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/objects-inl.h"
#include "src/runtime/runtime.h"
namespace v8 {

View File

@ -5,10 +5,12 @@
#if V8_TARGET_ARCH_MIPS64
#include "src/codegen.h"
#include "src/counters.h"
#include "src/debug/debug.h"
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/objects-inl.h"
#include "src/runtime/runtime.h"
namespace v8 {

View File

@ -4,11 +4,15 @@
#include "src/setup-isolate.h"
#include "src/assembler-inl.h"
#include "src/builtins/builtins.h"
#include "src/code-events.h"
#include "src/compiler/code-assembler.h"
#include "src/handles-inl.h"
#include "src/interface-descriptors.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/objects/shared-function-info.h"
namespace v8 {
namespace internal {

View File

@ -11,6 +11,7 @@
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/objects-inl.h"
#include "src/objects/debug-objects.h"
namespace v8 {
namespace internal {

View File

@ -194,6 +194,9 @@ Handle<Code> CodeStub::GetCode() {
return Handle<Code>(code, isolate());
}
CodeStub::Major CodeStub::GetMajorKey(Code* code_stub) {
return MajorKeyFromKey(code_stub->stub_key());
}
const char* CodeStub::MajorName(CodeStub::Major major_key) {
switch (major_key) {
@ -783,5 +786,18 @@ ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate)
: PlatformCodeStub(isolate) {}
CommonArrayConstructorStub::CommonArrayConstructorStub(
Isolate* isolate, ElementsKind kind,
AllocationSiteOverrideMode override_mode)
: TurboFanCodeStub(isolate) {
// It only makes sense to override local allocation site behavior
// if there is a difference between the global allocation site policy
// for an ElementsKind and the desired usage of the stub.
DCHECK(override_mode != DISABLE_ALLOCATION_SITES ||
AllocationSite::ShouldTrack(kind));
set_sub_minor_key(ElementsKindBits::encode(kind) |
AllocationSiteOverrideModeBits::encode(override_mode));
}
} // namespace internal
} // namespace v8

View File

@ -150,9 +150,7 @@ class CodeStub : public ZoneObject {
}
// Gets the major key from a code object that is a code stub or binary op IC.
static Major GetMajorKey(Code* code_stub) {
return MajorKeyFromKey(code_stub->stub_key());
}
static Major GetMajorKey(Code* code_stub);
static uint32_t NoCacheKey() { return MajorKeyBits::encode(NoCache); }
@ -989,16 +987,7 @@ class AllocateHeapNumberStub : public TurboFanCodeStub {
class CommonArrayConstructorStub : public TurboFanCodeStub {
protected:
CommonArrayConstructorStub(Isolate* isolate, ElementsKind kind,
AllocationSiteOverrideMode override_mode)
: TurboFanCodeStub(isolate) {
// It only makes sense to override local allocation site behavior
// if there is a difference between the global allocation site policy
// for an ElementsKind and the desired usage of the stub.
DCHECK(override_mode != DISABLE_ALLOCATION_SITES ||
AllocationSite::ShouldTrack(kind));
set_sub_minor_key(ElementsKindBits::encode(kind) |
AllocationSiteOverrideModeBits::encode(override_mode));
}
AllocationSiteOverrideMode override_mode);
void set_sub_minor_key(uint32_t key) { minor_key_ = key; }

View File

@ -113,11 +113,14 @@ class CompilationCacheTable;
class Constructor;
class Filler;
class InternalizedString;
class JSArgumentsObject;
class JSContextExtensionObject;
class JSError;
class JSSloppyArgumentsObject;
class MapCache;
class MutableHeapNumber;
class NativeContext;
class SloppyArgumentsElements;
class StringWrapper;
class Undetectable;
class UniqueName;

View File

@ -1035,6 +1035,10 @@ OutOfLineCode::OutOfLineCode(CodeGenerator* gen)
OutOfLineCode::~OutOfLineCode() {}
Handle<Object> DeoptimizationLiteral::Reify(Isolate* isolate) const {
return object_.is_null() ? isolate->factory()->NewNumber(number_) : object_;
}
} // namespace compiler
} // namespace internal
} // namespace v8

View File

@ -67,9 +67,7 @@ class DeoptimizationLiteral {
bit_cast<uint64_t>(number_) == bit_cast<uint64_t>(other.number_);
}
Handle<Object> Reify(Isolate* isolate) const {
return object_.is_null() ? isolate->factory()->NewNumber(number_) : object_;
}
Handle<Object> Reify(Isolate* isolate) const;
private:
Handle<Object> object_;

View File

@ -13,6 +13,7 @@
#include "src/compiler/node-properties.h"
#include "src/compiler/node.h"
#include "src/compiler/schedule.h"
#include "src/factory-inl.h"
namespace v8 {
namespace internal {

View File

@ -9,6 +9,7 @@
#include "src/compiler/node-matchers.h"
#include "src/compiler/operator-properties.h"
#include "src/compiler/simplified-operator.h"
#include "src/list-inl.h" // TODO(mstarzinger): Fix zone-handle-set.h instead!
#ifdef DEBUG
#define TRACE(...) \

View File

@ -22,6 +22,7 @@
#include "src/compiler/schedule.h"
#include "src/compiler/scheduler.h"
#include "src/interpreter/bytecodes.h"
#include "src/objects/script-inl.h"
#include "src/ostreams.h"
namespace v8 {

View File

@ -4,6 +4,7 @@
#include "src/compiler/code-generator.h"
#include "src/assembler-inl.h"
#include "src/callable.h"
#include "src/compilation-info.h"
#include "src/compiler/code-generator-impl.h"
@ -12,6 +13,7 @@
#include "src/compiler/osr.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/heap/heap-inl.h"
#include "src/ia32/assembler-ia32.h"
#include "src/ia32/macro-assembler-ia32.h"

View File

@ -19,13 +19,11 @@
#include "src/globals.h"
#include "src/macro-assembler.h"
#include "src/register-configuration.h"
#include "src/source-position.h"
#include "src/zone/zone-allocator.h"
namespace v8 {
namespace internal {
class SourcePosition;
namespace compiler {
class Schedule;

View File

@ -10,7 +10,7 @@
#include "src/compiler/linkage.h"
#include "src/compiler/node-matchers.h"
#include "src/compiler/node-properties.h"
#include "src/contexts.h"
#include "src/contexts-inl.h"
namespace v8 {
namespace internal {

View File

@ -12,6 +12,7 @@
#include "src/compiler/graph.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/node-matchers.h"
#include "src/conversions-inl.h"
namespace v8 {
namespace internal {

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/assembler-inl.h"
#include "src/callable.h"
#include "src/compilation-info.h"
#include "src/compiler/code-generator-impl.h"
@ -9,6 +10,7 @@
#include "src/compiler/gap-resolver.h"
#include "src/compiler/node-matchers.h"
#include "src/compiler/osr.h"
#include "src/heap/heap-inl.h"
#include "src/mips/macro-assembler-mips.h"
namespace v8 {

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/assembler-inl.h"
#include "src/callable.h"
#include "src/compilation-info.h"
#include "src/compiler/code-generator-impl.h"
@ -9,6 +10,7 @@
#include "src/compiler/gap-resolver.h"
#include "src/compiler/node-matchers.h"
#include "src/compiler/osr.h"
#include "src/heap/heap-inl.h"
#include "src/mips64/macro-assembler-mips64.h"
namespace v8 {

View File

@ -8,6 +8,7 @@
#include <memory>
#include <sstream>
#include "src/assembler-inl.h"
#include "src/base/adapters.h"
#include "src/base/optional.h"
#include "src/base/platform/elapsed-timer.h"

View File

@ -7,6 +7,7 @@
#include "src/compiler/node-properties.h"
#include "src/compiler/pipeline.h"
#include "src/compiler/scheduler.h"
#include "src/factory-inl.h"
namespace v8 {
namespace internal {
@ -34,6 +35,14 @@ RawMachineAssembler::RawMachineAssembler(
graph->SetEnd(graph->NewNode(common_.End(0)));
}
Node* RawMachineAssembler::NullConstant() {
return HeapConstant(isolate()->factory()->null_value());
}
Node* RawMachineAssembler::UndefinedConstant() {
return HeapConstant(isolate()->factory()->undefined_value());
}
Node* RawMachineAssembler::RelocatableIntPtrConstant(intptr_t value,
RelocInfo::Mode rmode) {
return kPointerSize == 8

View File

@ -63,13 +63,8 @@ class V8_EXPORT_PRIVATE RawMachineAssembler {
// place them into the current basic block. They don't perform control flow,
// hence will not switch the current basic block.
Node* NullConstant() {
return HeapConstant(isolate()->factory()->null_value());
}
Node* UndefinedConstant() {
return HeapConstant(isolate()->factory()->undefined_value());
}
Node* NullConstant();
Node* UndefinedConstant();
// Constants.
Node* PointerConstant(void* value) {

View File

@ -10,6 +10,7 @@
#include "src/code-factory.h"
#include "src/compiler/machine-operator.h"
#include "src/compiler/node-matchers.h"
#include "src/factory-inl.h"
namespace v8 {
namespace internal {

View File

@ -6,6 +6,7 @@
#include "src/ast/ast.h"
#include "src/base/hashmap.h"
#include "src/debug/debug.h"
#include "src/deoptimizer.h"
#include "src/frames-inl.h"
#include "src/isolate.h"

View File

@ -5,6 +5,7 @@
#include "src/debug/debug-evaluate.h"
#include "src/accessors.h"
#include "src/assembler-inl.h"
#include "src/compiler.h"
#include "src/contexts.h"
#include "src/debug/debug-frames.h"

View File

@ -450,6 +450,12 @@ void Deoptimizer::PrintFunctionName() {
}
}
Handle<JSFunction> Deoptimizer::function() const {
return Handle<JSFunction>(function_);
}
Handle<Code> Deoptimizer::compiled_code() const {
return Handle<Code>(compiled_code_);
}
Deoptimizer::~Deoptimizer() {
DCHECK(input_ == NULL && output_ == NULL);
@ -1945,6 +1951,10 @@ void TranslationBuffer::Add(int32_t value) {
} while (bits != 0);
}
TranslationIterator::TranslationIterator(ByteArray* buffer, int index)
: buffer_(buffer), index_(index) {
DCHECK(index >= 0 && index < buffer->length());
}
int32_t TranslationIterator::Next() {
// Run through the bytes until we reach one with a least significant
@ -1962,6 +1972,7 @@ int32_t TranslationIterator::Next() {
return is_negative ? -result : result;
}
bool TranslationIterator::HasNext() const { return index_ < buffer_->length(); }
Handle<ByteArray> TranslationBuffer::CreateByteArray(Factory* factory) {
Handle<ByteArray> result = factory->NewByteArray(CurrentIndex(), TENURED);

View File

@ -382,8 +382,8 @@ class Deoptimizer : public Malloced {
int output_count() const { return output_count_; }
Handle<JSFunction> function() const { return Handle<JSFunction>(function_); }
Handle<Code> compiled_code() const { return Handle<Code>(compiled_code_); }
Handle<JSFunction> function() const;
Handle<Code> compiled_code() const;
BailoutType bailout_type() const { return bailout_type_; }
// Number of created JS frames. Not all created frames are necessarily JS.
@ -823,14 +823,11 @@ class TranslationBuffer BASE_EMBEDDED {
class TranslationIterator BASE_EMBEDDED {
public:
TranslationIterator(ByteArray* buffer, int index)
: buffer_(buffer), index_(index) {
DCHECK(index >= 0 && index < buffer->length());
}
TranslationIterator(ByteArray* buffer, int index);
int32_t Next();
bool HasNext() const { return index_ < buffer_->length(); }
bool HasNext() const;
void Skip(int n) {
for (int i = 0; i < n; i++) Next();

View File

@ -4,6 +4,8 @@
#include "src/external-reference-table.h"
#include "src/objects/name-inl.h" // TODO(mstarzinger): For stub-cache.h only!
#include "src/accessors.h"
#include "src/assembler.h"
#include "src/counters.h"

View File

@ -7,6 +7,9 @@
#include "src/factory.h"
#include "src/handles-inl.h"
#include "src/objects-inl.h"
namespace v8 {
namespace internal {

View File

@ -18,25 +18,6 @@
namespace v8 {
namespace internal {
template <typename Derived>
FeedbackSlot FeedbackVectorSpecBase<Derived>::AddSlot(FeedbackSlotKind kind) {
int slot = This()->slots();
int entries_per_slot = FeedbackMetadata::GetSlotSize(kind);
This()->append(kind);
for (int i = 1; i < entries_per_slot; i++) {
This()->append(FeedbackSlotKind::kInvalid);
}
return FeedbackSlot(slot);
}
template <typename Derived>
FeedbackSlot FeedbackVectorSpecBase<Derived>::AddTypeProfileSlot() {
FeedbackSlot slot = AddSlot(FeedbackSlotKind::kTypeProfile);
CHECK_EQ(FeedbackVectorSpec::kTypeProfileSlotIndex,
FeedbackVector::GetIndex(slot));
return slot;
}
// static
FeedbackMetadata* FeedbackMetadata::cast(Object* obj) {
DCHECK(obj->IsFeedbackMetadata());

View File

@ -12,6 +12,35 @@
namespace v8 {
namespace internal {
template <typename Derived>
FeedbackSlot FeedbackVectorSpecBase<Derived>::AddSlot(FeedbackSlotKind kind) {
int slot = This()->slots();
int entries_per_slot = FeedbackMetadata::GetSlotSize(kind);
This()->append(kind);
for (int i = 1; i < entries_per_slot; i++) {
This()->append(FeedbackSlotKind::kInvalid);
}
return FeedbackSlot(slot);
}
template FeedbackSlot FeedbackVectorSpecBase<FeedbackVectorSpec>::AddSlot(
FeedbackSlotKind kind);
template FeedbackSlot FeedbackVectorSpecBase<StaticFeedbackVectorSpec>::AddSlot(
FeedbackSlotKind kind);
template <typename Derived>
FeedbackSlot FeedbackVectorSpecBase<Derived>::AddTypeProfileSlot() {
FeedbackSlot slot = AddSlot(FeedbackSlotKind::kTypeProfile);
CHECK_EQ(FeedbackVectorSpec::kTypeProfileSlotIndex,
FeedbackVector::GetIndex(slot));
return slot;
}
template FeedbackSlot
FeedbackVectorSpecBase<FeedbackVectorSpec>::AddTypeProfileSlot();
template FeedbackSlot
FeedbackVectorSpecBase<StaticFeedbackVectorSpec>::AddTypeProfileSlot();
bool FeedbackVectorSpec::HasTypeProfileSlot() const {
FeedbackSlot slot =
FeedbackVector::ToSlot(FeedbackVectorSpec::kTypeProfileSlotIndex);

View File

@ -357,7 +357,7 @@ class FeedbackVectorSpecBase {
DECL_PRINTER(FeedbackVectorSpec)
private:
inline FeedbackSlot AddSlot(FeedbackSlotKind kind);
FeedbackSlot AddSlot(FeedbackSlotKind kind);
Derived* This() { return static_cast<Derived*>(this); }
};

View File

@ -7,6 +7,7 @@
#include "src/handles.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
namespace v8 {
namespace internal {
@ -31,6 +32,9 @@ HandleScope::HandleScope(Isolate* isolate) {
data->level++;
}
template <typename T>
Handle<T>::Handle(T* object) : Handle(object, object->GetIsolate()) {}
template <typename T>
Handle<T>::Handle(T* object, Isolate* isolate) : HandleBase(object, isolate) {}

View File

@ -97,7 +97,7 @@ class Handle final : public HandleBase {
static_assert(std::is_base_of<Object, T>::value, "static type violation");
}
V8_INLINE explicit Handle(T* object) : Handle(object, object->GetIsolate()) {}
V8_INLINE explicit Handle(T* object);
V8_INLINE Handle(T* object, Isolate* isolate);
// Allocate a new handle for the object, do not canonicalize.

View File

@ -177,45 +177,6 @@ void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) {
}
}
Immediate::Immediate(int x) {
value_.immediate = x;
rmode_ = RelocInfo::NONE32;
}
Immediate::Immediate(Address x, RelocInfo::Mode rmode) {
value_.immediate = reinterpret_cast<int32_t>(x);
rmode_ = rmode;
}
Immediate::Immediate(const ExternalReference& ext) {
value_.immediate = reinterpret_cast<int32_t>(ext.address());
rmode_ = RelocInfo::EXTERNAL_REFERENCE;
}
Immediate::Immediate(Label* internal_offset) {
value_.immediate = reinterpret_cast<int32_t>(internal_offset);
rmode_ = RelocInfo::INTERNAL_REFERENCE;
}
Immediate::Immediate(Handle<HeapObject> handle) {
value_.immediate = reinterpret_cast<intptr_t>(handle.address());
rmode_ = RelocInfo::EMBEDDED_OBJECT;
}
Immediate::Immediate(Smi* value) {
value_.immediate = reinterpret_cast<intptr_t>(value);
rmode_ = RelocInfo::NONE32;
}
Immediate::Immediate(Address addr) {
value_.immediate = reinterpret_cast<int32_t>(addr);
rmode_ = RelocInfo::NONE32;
}
void Assembler::emit(uint32_t x) {
*reinterpret_cast<uint32_t*>(pc_) = x;
pc_ += sizeof(uint32_t);
@ -316,6 +277,10 @@ Address Assembler::target_address_from_return_address(Address pc) {
return pc - kCallTargetAddressOffset;
}
void Assembler::deserialization_set_special_target_at(
Isolate* isolate, Address instruction_payload, Code* code, Address target) {
set_target_address_at(isolate, instruction_payload, code, target);
}
Displacement Assembler::disp_at(Label* L) {
return Displacement(long_at(L->pos()));
@ -352,13 +317,6 @@ void Assembler::deserialization_set_target_internal_reference_at(
}
void Operand::set_modrm(int mod, Register rm) {
DCHECK((mod & -4) == 0);
buf_[0] = mod << 6 | rm.code();
len_ = 1;
}
void Operand::set_sib(ScaleFactor scale, Register index, Register base) {
DCHECK(len_ == 1);
DCHECK((scale & -4) == 0);
@ -375,33 +333,6 @@ void Operand::set_disp8(int8_t disp) {
}
void Operand::set_dispr(int32_t disp, RelocInfo::Mode rmode) {
DCHECK(len_ == 1 || len_ == 2);
int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]);
*p = disp;
len_ += sizeof(int32_t);
rmode_ = rmode;
}
Operand::Operand(Register reg) {
// reg
set_modrm(3, reg);
}
Operand::Operand(XMMRegister xmm_reg) {
Register reg = Register::from_code(xmm_reg.code());
set_modrm(3, reg);
}
Operand::Operand(int32_t disp, RelocInfo::Mode rmode) {
// [disp/r]
set_modrm(0, ebp);
set_dispr(disp, rmode);
}
Operand::Operand(Immediate imm) {
// [disp/r]
set_modrm(0, ebp);

View File

@ -47,9 +47,11 @@
#include <sys/sysctl.h>
#endif
#include "src/assembler-inl.h"
#include "src/base/bits.h"
#include "src/base/cpu.h"
#include "src/code-stubs.h"
#include "src/conversions-inl.h"
#include "src/disassembler.h"
#include "src/macro-assembler.h"
#include "src/v8.h"

View File

@ -233,12 +233,30 @@ enum RoundingMode {
class Immediate BASE_EMBEDDED {
public:
inline explicit Immediate(int x);
inline explicit Immediate(const ExternalReference& ext);
inline explicit Immediate(Handle<HeapObject> handle);
inline explicit Immediate(Smi* value);
inline explicit Immediate(Address addr);
inline explicit Immediate(Address x, RelocInfo::Mode rmode);
inline explicit Immediate(int x) {
value_.immediate = x;
rmode_ = RelocInfo::NONE32;
}
inline explicit Immediate(const ExternalReference& ext) {
value_.immediate = reinterpret_cast<int32_t>(ext.address());
rmode_ = RelocInfo::EXTERNAL_REFERENCE;
}
inline explicit Immediate(Handle<HeapObject> handle) {
value_.immediate = reinterpret_cast<intptr_t>(handle.address());
rmode_ = RelocInfo::EMBEDDED_OBJECT;
}
inline explicit Immediate(Smi* value) {
value_.immediate = reinterpret_cast<intptr_t>(value);
rmode_ = RelocInfo::NONE32;
}
inline explicit Immediate(Address addr) {
value_.immediate = reinterpret_cast<int32_t>(addr);
rmode_ = RelocInfo::NONE32;
}
inline explicit Immediate(Address x, RelocInfo::Mode rmode) {
value_.immediate = reinterpret_cast<int32_t>(x);
rmode_ = rmode;
}
static Immediate EmbeddedNumber(double number); // Smi or HeapNumber.
static Immediate EmbeddedCode(CodeStub* code);
@ -282,7 +300,10 @@ class Immediate BASE_EMBEDDED {
RelocInfo::Mode rmode() const { return rmode_; }
private:
inline explicit Immediate(Label* value);
inline explicit Immediate(Label* value) {
value_.immediate = reinterpret_cast<int32_t>(value);
rmode_ = RelocInfo::INTERNAL_REFERENCE;
}
union Value {
Value() {}
@ -316,13 +337,19 @@ enum ScaleFactor {
class Operand BASE_EMBEDDED {
public:
// reg
INLINE(explicit Operand(Register reg));
INLINE(explicit Operand(Register reg)) { set_modrm(3, reg); }
// XMM reg
INLINE(explicit Operand(XMMRegister xmm_reg));
INLINE(explicit Operand(XMMRegister xmm_reg)) {
Register reg = Register::from_code(xmm_reg.code());
set_modrm(3, reg);
}
// [disp/r]
INLINE(explicit Operand(int32_t disp, RelocInfo::Mode rmode));
INLINE(explicit Operand(int32_t disp, RelocInfo::Mode rmode)) {
set_modrm(0, ebp);
set_dispr(disp, rmode);
}
// [disp/r]
INLINE(explicit Operand(Immediate imm));
@ -378,11 +405,21 @@ class Operand BASE_EMBEDDED {
private:
// Set the ModRM byte without an encoded 'reg' register. The
// register is encoded later as part of the emit_operand operation.
inline void set_modrm(int mod, Register rm);
inline void set_modrm(int mod, Register rm) {
DCHECK((mod & -4) == 0);
buf_[0] = mod << 6 | rm.code();
len_ = 1;
}
inline void set_sib(ScaleFactor scale, Register index, Register base);
inline void set_disp8(int8_t disp);
inline void set_dispr(int32_t disp, RelocInfo::Mode rmode);
inline void set_dispr(int32_t disp, RelocInfo::Mode rmode) {
DCHECK(len_ == 1 || len_ == 2);
int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]);
*p = disp;
len_ += sizeof(int32_t);
rmode_ = rmode;
}
byte buf_[6];
// The number of bytes in buf_.
@ -500,9 +537,7 @@ class Assembler : public AssemblerBase {
// This is for calls and branches within generated code.
inline static void deserialization_set_special_target_at(
Isolate* isolate, Address instruction_payload, Code* code,
Address target) {
set_target_address_at(isolate, instruction_payload, code, target);
}
Address target);
// This sets the internal reference at the pc.
inline static void deserialization_set_target_internal_reference_at(

View File

@ -5,12 +5,14 @@
#if V8_TARGET_ARCH_IA32
#include "src/api-arguments.h"
#include "src/assembler-inl.h"
#include "src/base/bits.h"
#include "src/bootstrapper.h"
#include "src/code-stubs.h"
#include "src/codegen.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/heap/heap-inl.h"
#include "src/ic/handler-compiler.h"
#include "src/ic/ic.h"
#include "src/ic/stub-cache.h"
@ -994,6 +996,46 @@ void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(
stub2.GetCode();
}
RecordWriteStub::Mode RecordWriteStub::GetMode(Code* stub) {
byte first_instruction = stub->instruction_start()[0];
byte second_instruction = stub->instruction_start()[2];
if (first_instruction == kTwoByteJumpInstruction) {
return INCREMENTAL;
}
DCHECK(first_instruction == kTwoByteNopInstruction);
if (second_instruction == kFiveByteJumpInstruction) {
return INCREMENTAL_COMPACTION;
}
DCHECK(second_instruction == kFiveByteNopInstruction);
return STORE_BUFFER_ONLY;
}
void RecordWriteStub::Patch(Code* stub, Mode mode) {
switch (mode) {
case STORE_BUFFER_ONLY:
DCHECK(GetMode(stub) == INCREMENTAL ||
GetMode(stub) == INCREMENTAL_COMPACTION);
stub->instruction_start()[0] = kTwoByteNopInstruction;
stub->instruction_start()[2] = kFiveByteNopInstruction;
break;
case INCREMENTAL:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
stub->instruction_start()[0] = kTwoByteJumpInstruction;
break;
case INCREMENTAL_COMPACTION:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
stub->instruction_start()[0] = kTwoByteNopInstruction;
stub->instruction_start()[2] = kFiveByteJumpInstruction;
break;
}
DCHECK(GetMode(stub) == mode);
Assembler::FlushICache(stub->GetIsolate(), stub->instruction_start(), 7);
}
// Takes the input in 3 registers: address_ value_ and object_. A pointer to
// the value has just been written into the object, now this stub makes sure
@ -1085,6 +1127,9 @@ void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm) {
regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode());
}
void RecordWriteStub::Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,

View File

@ -127,46 +127,9 @@ class RecordWriteStub: public PlatformCodeStub {
static const byte kFiveByteNopInstruction = 0x3d; // Cmpl eax, #imm32.
static const byte kFiveByteJumpInstruction = 0xe9; // Jmp #imm32.
static Mode GetMode(Code* stub) {
byte first_instruction = stub->instruction_start()[0];
byte second_instruction = stub->instruction_start()[2];
static Mode GetMode(Code* stub);
if (first_instruction == kTwoByteJumpInstruction) {
return INCREMENTAL;
}
DCHECK(first_instruction == kTwoByteNopInstruction);
if (second_instruction == kFiveByteJumpInstruction) {
return INCREMENTAL_COMPACTION;
}
DCHECK(second_instruction == kFiveByteNopInstruction);
return STORE_BUFFER_ONLY;
}
static void Patch(Code* stub, Mode mode) {
switch (mode) {
case STORE_BUFFER_ONLY:
DCHECK(GetMode(stub) == INCREMENTAL ||
GetMode(stub) == INCREMENTAL_COMPACTION);
stub->instruction_start()[0] = kTwoByteNopInstruction;
stub->instruction_start()[2] = kFiveByteNopInstruction;
break;
case INCREMENTAL:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
stub->instruction_start()[0] = kTwoByteJumpInstruction;
break;
case INCREMENTAL_COMPACTION:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
stub->instruction_start()[0] = kTwoByteNopInstruction;
stub->instruction_start()[2] = kFiveByteJumpInstruction;
break;
}
DCHECK(GetMode(stub) == mode);
Assembler::FlushICache(stub->GetIsolate(), stub->instruction_start(), 7);
}
static void Patch(Code* stub, Mode mode);
DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
@ -303,9 +266,7 @@ class RecordWriteStub: public PlatformCodeStub {
Mode mode);
void InformIncrementalMarker(MacroAssembler* masm);
void Activate(Code* code) override {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
void Activate(Code* code) override;
Register object() const {
return Register::from_code(ObjectBits::decode(minor_key_));

View File

@ -7,6 +7,7 @@
#if V8_TARGET_ARCH_IA32
#include "src/codegen.h"
#include "src/factory-inl.h"
#include "src/heap/heap.h"
#include "src/macro-assembler.h"

View File

@ -4,6 +4,7 @@
#if V8_TARGET_ARCH_IA32
#include "src/assembler-inl.h"
#include "src/codegen.h"
#include "src/deoptimizer.h"
#include "src/frame-constants.h"

View File

@ -15,6 +15,7 @@
#include "src/frames-inl.h"
#include "src/runtime/runtime.h"
#include "src/ia32/assembler-ia32-inl.h"
#include "src/ia32/macro-assembler-ia32.h"
namespace v8 {
@ -27,6 +28,15 @@ MacroAssembler::MacroAssembler(Isolate* isolate, void* buffer, int size,
CodeObjectRequired create_code_object)
: TurboAssembler(isolate, buffer, size, create_code_object) {}
TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size), isolate_(isolate) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ =
Handle<HeapObject>::New(isolate->heap()->undefined_value(), isolate);
}
}
void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) {
if (isolate()->heap()->RootCanBeTreatedAsConstant(index)) {
Handle<Object> object = isolate()->heap()->root_handle(index);

View File

@ -8,6 +8,7 @@
#include "src/assembler.h"
#include "src/bailout-reason.h"
#include "src/globals.h"
#include "src/ia32/assembler-ia32.h"
namespace v8 {
namespace internal {
@ -53,13 +54,7 @@ bool AreAliased(Register reg1, Register reg2, Register reg3 = no_reg,
class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size), isolate_(isolate) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ =
Handle<HeapObject>::New(isolate->heap()->undefined_value(), isolate);
}
}
CodeObjectRequired create_code_object);
void set_has_frame(bool value) { has_frame_ = value; }
bool has_frame() const { return has_frame_; }
@ -514,15 +509,6 @@ class MacroAssembler : public TurboAssembler {
void PushSafepointRegisters() { pushad(); }
void PopSafepointRegisters() { popad(); }
void CmpObject(Register reg, Handle<Object> object) {
AllowDeferredHandleDereference heap_object_check;
if (object->IsHeapObject()) {
cmp(reg, Handle<HeapObject>::cast(object));
} else {
cmp(reg, Immediate(Smi::cast(*object)));
}
}
void GetWeakValue(Register value, Handle<WeakCell> cell);
// Load the value of the weak cell in the value register. Branch to the given

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/objects/name-inl.h" // TODO(mstarzinger): For stub-cache.h only!
#include "src/ic/stub-cache.h"
#include "src/ast/ast.h"

View File

@ -17,6 +17,7 @@
#include "src/interpreter/bytecode-register-allocator.h"
#include "src/interpreter/control-flow-builders.h"
#include "src/objects-inl.h"
#include "src/objects/debug-objects.h"
#include "src/parsing/parse-info.h"
#include "src/parsing/token.h"

View File

@ -11,6 +11,7 @@
#include "src/builtins/builtins-constructor-gen.h"
#include "src/code-events.h"
#include "src/code-factory.h"
#include "src/debug/debug.h"
#include "src/factory.h"
#include "src/ic/accessor-assembler.h"
#include "src/ic/binary-op-assembler.h"

View File

@ -10,11 +10,12 @@
#include "src/codegen.h"
#include "src/compilation-info.h"
#include "src/compiler.h"
#include "src/counters.h"
#include "src/counters-inl.h"
#include "src/interpreter/bytecode-generator.h"
#include "src/interpreter/bytecodes.h"
#include "src/log.h"
#include "src/objects.h"
#include "src/objects-inl.h"
#include "src/objects/shared-function-info.h"
#include "src/setup-isolate.h"
#include "src/visitors.h"

View File

@ -146,7 +146,7 @@ class List {
// Halve the capacity if fill level is less than a quarter.
INLINE(void Trim(AllocationPolicy allocator = AllocationPolicy()));
bool Contains(const T& elm) const;
inline bool Contains(const T& elm) const;
int CountOccurrences(const T& elm, int start, int end) const;
// Iterate through all list entries, starting at index 0.

View File

@ -5,7 +5,8 @@
#ifndef V8_MACRO_ASSEMBLER_H_
#define V8_MACRO_ASSEMBLER_H_
#include "src/assembler-inl.h"
#include "src/assembler.h"
#include "src/frames.h"
// Helper types to make boolean flag easier to read at call-site.
enum InvokeFlag {

View File

@ -54,26 +54,15 @@ bool CpuFeatures::SupportsWasmSimd128() { return IsSupported(MIPS_SIMD); }
// -----------------------------------------------------------------------------
// Operand and MemOperand.
Operand::Operand(int32_t immediate, RelocInfo::Mode rmode)
: rm_(no_reg), rmode_(rmode) {
value_.immediate = immediate;
}
Operand::Operand(const ExternalReference& f)
: rm_(no_reg), rmode_(RelocInfo::EXTERNAL_REFERENCE) {
value_.immediate = reinterpret_cast<int32_t>(f.address());
}
Operand::Operand(Smi* value) : rm_(no_reg), rmode_(RelocInfo::NONE32) {
value_.immediate = reinterpret_cast<intptr_t>(value);
}
Operand::Operand(Register rm) : rm_(rm) {}
bool Operand::is_reg() const {
return rm_.is_valid();
}
int32_t Operand::immediate() const {
DCHECK(!is_reg());
DCHECK(!IsHeapObjectRequest());
return value_.immediate;
}
// -----------------------------------------------------------------------------
// RelocInfo.
@ -150,6 +139,21 @@ Address Assembler::target_address_from_return_address(Address pc) {
return pc - kCallTargetAddressOffset;
}
void Assembler::deserialization_set_special_target_at(
Isolate* isolate, Address instruction_payload, Code* code, Address target) {
if (IsMipsArchVariant(kMips32r6)) {
// On R6 the address location is shifted by one instruction
set_target_address_at(
isolate,
instruction_payload - (kInstructionsFor32BitConstant - 1) * kInstrSize,
code, target);
} else {
set_target_address_at(
isolate,
instruction_payload - kInstructionsFor32BitConstant * kInstrSize, code,
target);
}
}
void Assembler::set_target_internal_reference_encoded_at(Address pc,
Address target) {
@ -375,6 +379,7 @@ void Assembler::emit(Instr x, CompactBranchType is_compact_branch) {
EmitHelper(x, is_compact_branch);
}
EnsureSpace::EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); }
} // namespace internal
} // namespace v8

View File

@ -386,28 +386,33 @@ class Operand BASE_EMBEDDED {
public:
// Immediate.
INLINE(explicit Operand(int32_t immediate,
RelocInfo::Mode rmode = RelocInfo::NONE32));
INLINE(explicit Operand(const ExternalReference& f));
RelocInfo::Mode rmode = RelocInfo::NONE32))
: rm_(no_reg), rmode_(rmode) {
value_.immediate = immediate;
}
INLINE(explicit Operand(const ExternalReference& f))
: rm_(no_reg), rmode_(RelocInfo::EXTERNAL_REFERENCE) {
value_.immediate = reinterpret_cast<int32_t>(f.address());
}
INLINE(explicit Operand(const char* s));
INLINE(explicit Operand(Object** opp));
INLINE(explicit Operand(Context** cpp));
explicit Operand(Handle<HeapObject> handle);
INLINE(explicit Operand(Smi* value));
INLINE(explicit Operand(Smi* value))
: rm_(no_reg), rmode_(RelocInfo::NONE32) {
value_.immediate = reinterpret_cast<intptr_t>(value);
}
static Operand EmbeddedNumber(double number); // Smi or HeapNumber.
static Operand EmbeddedCode(CodeStub* stub);
// Register.
INLINE(explicit Operand(Register rm));
INLINE(explicit Operand(Register rm)) : rm_(rm) {}
// Return true if this is a register operand.
INLINE(bool is_reg() const);
inline int32_t immediate() const {
DCHECK(!is_reg());
DCHECK(!IsHeapObjectRequest());
return value_.immediate;
}
inline int32_t immediate() const;
bool IsImmediate() const { return !rm_.is_valid(); }
@ -594,21 +599,7 @@ class Assembler : public AssemblerBase {
// has already deserialized the lui/ori instructions etc.
inline static void deserialization_set_special_target_at(
Isolate* isolate, Address instruction_payload, Code* code,
Address target) {
if (IsMipsArchVariant(kMips32r6)) {
// On R6 the address location is shifted by one instruction
set_target_address_at(
isolate,
instruction_payload -
(kInstructionsFor32BitConstant - 1) * kInstrSize,
code, target);
} else {
set_target_address_at(
isolate,
instruction_payload - kInstructionsFor32BitConstant * kInstrSize,
code, target);
}
}
Address target);
// This sets the internal reference at the pc.
inline static void deserialization_set_target_internal_reference_at(
@ -2243,9 +2234,7 @@ class Assembler : public AssemblerBase {
class EnsureSpace BASE_EMBEDDED {
public:
explicit EnsureSpace(Assembler* assembler) {
assembler->CheckBuffer();
}
explicit inline EnsureSpace(Assembler* assembler);
};
class UseScratchRegisterScope {

View File

@ -11,6 +11,7 @@
#include "src/codegen.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/heap/heap-inl.h"
#include "src/ic/handler-compiler.h"
#include "src/ic/ic.h"
#include "src/ic/stub-cache.h"
@ -1045,6 +1046,49 @@ void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(
stub2.GetCode();
}
RecordWriteStub::Mode RecordWriteStub::GetMode(Code* stub) {
Instr first_instruction = Assembler::instr_at(stub->instruction_start());
Instr second_instruction = Assembler::instr_at(stub->instruction_start() +
2 * Assembler::kInstrSize);
if (Assembler::IsBeq(first_instruction)) {
return INCREMENTAL;
}
DCHECK(Assembler::IsBne(first_instruction));
if (Assembler::IsBeq(second_instruction)) {
return INCREMENTAL_COMPACTION;
}
DCHECK(Assembler::IsBne(second_instruction));
return STORE_BUFFER_ONLY;
}
void RecordWriteStub::Patch(Code* stub, Mode mode) {
MacroAssembler masm(stub->GetIsolate(), stub->instruction_start(),
stub->instruction_size(), CodeObjectRequired::kNo);
switch (mode) {
case STORE_BUFFER_ONLY:
DCHECK(GetMode(stub) == INCREMENTAL ||
GetMode(stub) == INCREMENTAL_COMPACTION);
PatchBranchIntoNop(&masm, 0);
PatchBranchIntoNop(&masm, 2 * Assembler::kInstrSize);
break;
case INCREMENTAL:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, 0);
break;
case INCREMENTAL_COMPACTION:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, 2 * Assembler::kInstrSize);
break;
}
DCHECK(GetMode(stub) == mode);
Assembler::FlushICache(stub->GetIsolate(), stub->instruction_start(),
4 * Assembler::kInstrSize);
}
// Takes the input in 3 registers: address_ value_ and object_. A pointer to
// the value has just been written into the object, now this stub makes sure
@ -1144,6 +1188,9 @@ void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm) {
regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode());
}
void RecordWriteStub::Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,

View File

@ -103,49 +103,9 @@ class RecordWriteStub: public PlatformCodeStub {
DCHECK(Assembler::IsBeq(masm->instr_at(pos)));
}
static Mode GetMode(Code* stub) {
Instr first_instruction = Assembler::instr_at(stub->instruction_start());
Instr second_instruction = Assembler::instr_at(stub->instruction_start() +
2 * Assembler::kInstrSize);
static Mode GetMode(Code* stub);
if (Assembler::IsBeq(first_instruction)) {
return INCREMENTAL;
}
DCHECK(Assembler::IsBne(first_instruction));
if (Assembler::IsBeq(second_instruction)) {
return INCREMENTAL_COMPACTION;
}
DCHECK(Assembler::IsBne(second_instruction));
return STORE_BUFFER_ONLY;
}
static void Patch(Code* stub, Mode mode) {
MacroAssembler masm(stub->GetIsolate(), stub->instruction_start(),
stub->instruction_size(), CodeObjectRequired::kNo);
switch (mode) {
case STORE_BUFFER_ONLY:
DCHECK(GetMode(stub) == INCREMENTAL ||
GetMode(stub) == INCREMENTAL_COMPACTION);
PatchBranchIntoNop(&masm, 0);
PatchBranchIntoNop(&masm, 2 * Assembler::kInstrSize);
break;
case INCREMENTAL:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, 0);
break;
case INCREMENTAL_COMPACTION:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, 2 * Assembler::kInstrSize);
break;
}
DCHECK(GetMode(stub) == mode);
Assembler::FlushICache(stub->GetIsolate(), stub->instruction_start(),
4 * Assembler::kInstrSize);
}
static void Patch(Code* stub, Mode mode);
DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
@ -222,9 +182,7 @@ class RecordWriteStub: public PlatformCodeStub {
Mode mode);
void InformIncrementalMarker(MacroAssembler* masm);
void Activate(Code* code) override {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
void Activate(Code* code) override;
Register object() const {
return Register::from_code(ObjectBits::decode(minor_key_));

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/assembler-inl.h"
#include "src/codegen.h"
#include "src/deoptimizer.h"
#include "src/register-configuration.h"

View File

@ -13,6 +13,7 @@
#include "src/debug/debug.h"
#include "src/external-reference-table.h"
#include "src/frames-inl.h"
#include "src/mips/assembler-mips-inl.h"
#include "src/mips/macro-assembler-mips.h"
#include "src/register-configuration.h"
#include "src/runtime/runtime.h"
@ -24,6 +25,17 @@ MacroAssembler::MacroAssembler(Isolate* isolate, void* buffer, int size,
CodeObjectRequired create_code_object)
: TurboAssembler(isolate, buffer, size, create_code_object) {}
TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size),
isolate_(isolate),
has_double_zero_reg_set_(false) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ =
Handle<HeapObject>::New(isolate->heap()->undefined_value(), isolate);
}
}
int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion1,
Register exclusion2,

View File

@ -128,15 +128,7 @@ inline MemOperand CFunctionArgumentOperand(int index) {
class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size),
isolate_(isolate),
has_double_zero_reg_set_(false) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ =
Handle<HeapObject>::New(isolate->heap()->undefined_value(), isolate);
}
}
CodeObjectRequired create_code_object);
void set_has_frame(bool value) { has_frame_ = value; }
bool has_frame() const { return has_frame_; }
@ -1156,11 +1148,6 @@ class MacroAssembler : public TurboAssembler {
Register map,
Register type_reg);
void GetInstanceType(Register object_map, Register object_instance_type) {
lbu(object_instance_type,
FieldMemOperand(object_map, Map::kInstanceTypeOffset));
}
// Compare an object's map with the specified map and its transitioned
// elements maps if mode is ALLOW_ELEMENT_TRANSITION_MAPS. Jumps to
// "branch_to" if the result of the comparison is "cond". If multiple map

View File

@ -9,7 +9,7 @@
#if V8_TARGET_ARCH_MIPS
#include "src/assembler.h"
#include "src/assembler-inl.h"
#include "src/base/bits.h"
#include "src/codegen.h"
#include "src/disasm.h"

View File

@ -54,26 +54,15 @@ bool CpuFeatures::SupportsWasmSimd128() { return IsSupported(MIPS_SIMD); }
// -----------------------------------------------------------------------------
// Operand and MemOperand.
Operand::Operand(int64_t immediate, RelocInfo::Mode rmode)
: rm_(no_reg), rmode_(rmode) {
value_.immediate = immediate;
}
Operand::Operand(const ExternalReference& f)
: rm_(no_reg), rmode_(RelocInfo::EXTERNAL_REFERENCE) {
value_.immediate = reinterpret_cast<int64_t>(f.address());
}
Operand::Operand(Smi* value) : rm_(no_reg), rmode_(RelocInfo::NONE32) {
value_.immediate = reinterpret_cast<intptr_t>(value);
}
Operand::Operand(Register rm) : rm_(rm) {}
bool Operand::is_reg() const {
return rm_.is_valid();
}
int64_t Operand::immediate() const {
DCHECK(!is_reg());
DCHECK(!IsHeapObjectRequest());
return value_.immediate;
}
// -----------------------------------------------------------------------------
// RelocInfo.
@ -143,6 +132,12 @@ Address Assembler::target_address_from_return_address(Address pc) {
return pc - kCallTargetAddressOffset;
}
void Assembler::deserialization_set_special_target_at(
Isolate* isolate, Address instruction_payload, Code* code, Address target) {
set_target_address_at(
isolate, instruction_payload - kInstructionsFor64BitConstant * kInstrSize,
code, target);
}
void Assembler::set_target_internal_reference_encoded_at(Address pc,
Address target) {
@ -356,6 +351,7 @@ void Assembler::emit(uint64_t data) {
EmitHelper(data);
}
EnsureSpace::EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); }
} // namespace internal
} // namespace v8

View File

@ -394,28 +394,33 @@ class Operand BASE_EMBEDDED {
public:
// Immediate.
INLINE(explicit Operand(int64_t immediate,
RelocInfo::Mode rmode = RelocInfo::NONE64));
INLINE(explicit Operand(const ExternalReference& f));
RelocInfo::Mode rmode = RelocInfo::NONE64))
: rm_(no_reg), rmode_(rmode) {
value_.immediate = immediate;
}
INLINE(explicit Operand(const ExternalReference& f))
: rm_(no_reg), rmode_(RelocInfo::EXTERNAL_REFERENCE) {
value_.immediate = reinterpret_cast<int64_t>(f.address());
}
INLINE(explicit Operand(const char* s));
INLINE(explicit Operand(Object** opp));
INLINE(explicit Operand(Context** cpp));
explicit Operand(Handle<HeapObject> handle);
INLINE(explicit Operand(Smi* value));
INLINE(explicit Operand(Smi* value))
: rm_(no_reg), rmode_(RelocInfo::NONE32) {
value_.immediate = reinterpret_cast<intptr_t>(value);
}
static Operand EmbeddedNumber(double number); // Smi or HeapNumber.
static Operand EmbeddedCode(CodeStub* stub);
// Register.
INLINE(explicit Operand(Register rm));
INLINE(explicit Operand(Register rm)) : rm_(rm) {}
// Return true if this is a register operand.
INLINE(bool is_reg() const);
inline int64_t immediate() const {
DCHECK(!is_reg());
DCHECK(!IsHeapObjectRequest());
return value_.immediate;
}
inline int64_t immediate() const;
bool IsImmediate() const { return !rm_.is_valid(); }
@ -605,12 +610,7 @@ class Assembler : public AssemblerBase {
// has already deserialized the lui/ori instructions etc.
inline static void deserialization_set_special_target_at(
Isolate* isolate, Address instruction_payload, Code* code,
Address target) {
set_target_address_at(
isolate,
instruction_payload - kInstructionsFor64BitConstant * kInstrSize, code,
target);
}
Address target);
// This sets the internal reference at the pc.
inline static void deserialization_set_target_internal_reference_at(
@ -2300,9 +2300,7 @@ class Assembler : public AssemblerBase {
class EnsureSpace BASE_EMBEDDED {
public:
explicit EnsureSpace(Assembler* assembler) {
assembler->CheckBuffer();
}
explicit inline EnsureSpace(Assembler* assembler);
};
class UseScratchRegisterScope {

View File

@ -10,6 +10,7 @@
#include "src/codegen.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/heap/heap-inl.h"
#include "src/ic/handler-compiler.h"
#include "src/ic/ic.h"
#include "src/ic/stub-cache.h"
@ -1042,6 +1043,49 @@ void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(
stub2.GetCode();
}
RecordWriteStub::Mode RecordWriteStub::GetMode(Code* stub) {
Instr first_instruction = Assembler::instr_at(stub->instruction_start());
Instr second_instruction = Assembler::instr_at(stub->instruction_start() +
2 * Assembler::kInstrSize);
if (Assembler::IsBeq(first_instruction)) {
return INCREMENTAL;
}
DCHECK(Assembler::IsBne(first_instruction));
if (Assembler::IsBeq(second_instruction)) {
return INCREMENTAL_COMPACTION;
}
DCHECK(Assembler::IsBne(second_instruction));
return STORE_BUFFER_ONLY;
}
void RecordWriteStub::Patch(Code* stub, Mode mode) {
MacroAssembler masm(stub->GetIsolate(), stub->instruction_start(),
stub->instruction_size(), CodeObjectRequired::kNo);
switch (mode) {
case STORE_BUFFER_ONLY:
DCHECK(GetMode(stub) == INCREMENTAL ||
GetMode(stub) == INCREMENTAL_COMPACTION);
PatchBranchIntoNop(&masm, 0);
PatchBranchIntoNop(&masm, 2 * Assembler::kInstrSize);
break;
case INCREMENTAL:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, 0);
break;
case INCREMENTAL_COMPACTION:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, 2 * Assembler::kInstrSize);
break;
}
DCHECK(GetMode(stub) == mode);
Assembler::FlushICache(stub->GetIsolate(), stub->instruction_start(),
4 * Assembler::kInstrSize);
}
// Takes the input in 3 registers: address_ value_ and object_. A pointer to
// the value has just been written into the object, now this stub makes sure
@ -1141,6 +1185,9 @@ void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm) {
regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode());
}
void RecordWriteStub::Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,

View File

@ -104,49 +104,9 @@ class RecordWriteStub: public PlatformCodeStub {
DCHECK(Assembler::IsBeq(masm->instr_at(pos)));
}
static Mode GetMode(Code* stub) {
Instr first_instruction = Assembler::instr_at(stub->instruction_start());
Instr second_instruction = Assembler::instr_at(stub->instruction_start() +
2 * Assembler::kInstrSize);
static Mode GetMode(Code* stub);
if (Assembler::IsBeq(first_instruction)) {
return INCREMENTAL;
}
DCHECK(Assembler::IsBne(first_instruction));
if (Assembler::IsBeq(second_instruction)) {
return INCREMENTAL_COMPACTION;
}
DCHECK(Assembler::IsBne(second_instruction));
return STORE_BUFFER_ONLY;
}
static void Patch(Code* stub, Mode mode) {
MacroAssembler masm(stub->GetIsolate(), stub->instruction_start(),
stub->instruction_size(), CodeObjectRequired::kNo);
switch (mode) {
case STORE_BUFFER_ONLY:
DCHECK(GetMode(stub) == INCREMENTAL ||
GetMode(stub) == INCREMENTAL_COMPACTION);
PatchBranchIntoNop(&masm, 0);
PatchBranchIntoNop(&masm, 2 * Assembler::kInstrSize);
break;
case INCREMENTAL:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, 0);
break;
case INCREMENTAL_COMPACTION:
DCHECK(GetMode(stub) == STORE_BUFFER_ONLY);
PatchNopIntoBranch(&masm, 2 * Assembler::kInstrSize);
break;
}
DCHECK(GetMode(stub) == mode);
Assembler::FlushICache(stub->GetIsolate(), stub->instruction_start(),
4 * Assembler::kInstrSize);
}
static void Patch(Code* stub, Mode mode);
DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
@ -223,9 +183,7 @@ class RecordWriteStub: public PlatformCodeStub {
Mode mode);
void InformIncrementalMarker(MacroAssembler* masm);
void Activate(Code* code) override {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
void Activate(Code* code) override;
Register object() const {
return Register::from_code(ObjectBits::decode(minor_key_));

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/assembler-inl.h"
#include "src/codegen.h"
#include "src/deoptimizer.h"
#include "src/register-configuration.h"

View File

@ -13,6 +13,7 @@
#include "src/debug/debug.h"
#include "src/external-reference-table.h"
#include "src/frames-inl.h"
#include "src/mips64/assembler-mips64-inl.h"
#include "src/mips64/macro-assembler-mips64.h"
#include "src/register-configuration.h"
#include "src/runtime/runtime.h"
@ -24,6 +25,17 @@ MacroAssembler::MacroAssembler(Isolate* isolate, void* buffer, int size,
CodeObjectRequired create_code_object)
: TurboAssembler(isolate, buffer, size, create_code_object) {}
TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size),
isolate_(isolate),
has_double_zero_reg_set_(false) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ =
Handle<HeapObject>::New(isolate->heap()->undefined_value(), isolate);
}
}
int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion1,
Register exclusion2,

View File

@ -157,15 +157,7 @@ inline MemOperand CFunctionArgumentOperand(int index) {
class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size),
isolate_(isolate),
has_double_zero_reg_set_(false) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ =
Handle<HeapObject>::New(isolate->heap()->undefined_value(), isolate);
}
}
CodeObjectRequired create_code_object);
void set_has_frame(bool value) { has_frame_ = value; }
bool has_frame() const { return has_frame_; }
@ -1252,11 +1244,6 @@ class MacroAssembler : public TurboAssembler {
Register map,
Register type_reg);
void GetInstanceType(Register object_map, Register object_instance_type) {
Lbu(object_instance_type,
FieldMemOperand(object_map, Map::kInstanceTypeOffset));
}
// Compare an object's map with the specified map and its transitioned
// elements maps if mode is ALLOW_ELEMENT_TRANSITION_MAPS. Jumps to
// "branch_to" if the result of the comparison is "cond". If multiple map

View File

@ -9,7 +9,7 @@
#if V8_TARGET_ARCH_MIPS64
#include "src/assembler.h"
#include "src/assembler-inl.h"
#include "src/base/bits.h"
#include "src/codegen.h"
#include "src/disasm.h"

View File

@ -7,6 +7,8 @@
#include "src/objects/name.h"
#include "src/heap/heap-inl.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"

View File

@ -6,8 +6,10 @@
#include "src/regexp/ia32/regexp-macro-assembler-ia32.h"
#include "src/assembler-inl.h"
#include "src/log.h"
#include "src/macro-assembler.h"
#include "src/objects-inl.h"
#include "src/regexp/regexp-macro-assembler.h"
#include "src/regexp/regexp-stack.h"
#include "src/unicode.h"

View File

@ -6,9 +6,11 @@
#include "src/regexp/mips/regexp-macro-assembler-mips.h"
#include "src/assembler-inl.h"
#include "src/code-stubs.h"
#include "src/log.h"
#include "src/macro-assembler.h"
#include "src/objects-inl.h"
#include "src/regexp/regexp-macro-assembler.h"
#include "src/regexp/regexp-stack.h"
#include "src/unicode.h"

View File

@ -6,9 +6,11 @@
#include "src/regexp/mips64/regexp-macro-assembler-mips64.h"
#include "src/assembler-inl.h"
#include "src/code-stubs.h"
#include "src/log.h"
#include "src/macro-assembler.h"
#include "src/objects-inl.h"
#include "src/regexp/regexp-macro-assembler.h"
#include "src/regexp/regexp-stack.h"
#include "src/unicode.h"

View File

@ -5,7 +5,6 @@
#include "src/snapshot/serializer-common.h"
#include "src/external-reference-table.h"
#include "src/ic/stub-cache.h"
#include "src/objects-inl.h"
namespace v8 {

View File

@ -6,6 +6,7 @@
#include <memory>
#include "src/api.h"
#include "src/assembler-inl.h"
#include "src/code-stubs.h"
#include "src/debug/interface-types.h"
#include "src/frames-inl.h"

Some files were not shown because too many files have changed in this diff Show More