// The translation includes one command per value in the environment.
int translation_size = environment->translation_size();
- // The output frame height does not include the parameters.
- int height = translation_size - environment->parameter_count();
WriteTranslation(environment->outer(), translation);
-
- switch (environment->frame_type()) {
- case JS_FUNCTION: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginJSFrame(environment->ast_id(), shared_id, height);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_CONSTRUCT: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginConstructStubFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_GETTER: {
- DCHECK(translation_size == 1);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginGetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_SETTER: {
- DCHECK(translation_size == 2);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginSetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case ARGUMENTS_ADAPTOR: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginArgumentsAdaptorFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case STUB:
- translation->BeginCompiledStubFrame(translation_size);
- break;
- }
+ WriteTranslationFrame(environment, translation);
int object_index = 0;
int dematerialized_index = 0;
}
-int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) {
- int result = deoptimization_literals_.length();
- for (int i = 0; i < deoptimization_literals_.length(); ++i) {
- if (deoptimization_literals_[i].is_identical_to(literal)) return i;
- }
- deoptimization_literals_.Add(literal, zone());
- return result;
-}
-
-
void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
DCHECK_EQ(0, deoptimization_literals_.length());
for (auto function : chunk()->inlined_functions()) {
: LCodeGenBase(chunk, assembler, info),
deoptimizations_(4, info->zone()),
jump_table_(4, info->zone()),
- deoptimization_literals_(8, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
translations_(info->zone()),
int* object_index_pointer,
int* dematerialized_index_pointer);
void PopulateDeoptimizationData(Handle<Code> code);
- int DefineDeoptimizationLiteral(Handle<Object> literal);
void PopulateDeoptimizationLiteralsWithInlinedFunctions();
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry> jump_table_;
- ZoneList<Handle<Object> > deoptimization_literals_;
int inlined_function_count_;
Scope* const scope_;
TranslationBuffer translations_;
// The translation includes one command per value in the environment.
int translation_size = environment->translation_size();
- // The output frame height does not include the parameters.
- int height = translation_size - environment->parameter_count();
WriteTranslation(environment->outer(), translation);
-
- switch (environment->frame_type()) {
- case JS_FUNCTION: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginJSFrame(environment->ast_id(), shared_id, height);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_CONSTRUCT: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginConstructStubFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_GETTER: {
- DCHECK(translation_size == 1);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginGetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_SETTER: {
- DCHECK(translation_size == 2);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginSetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case ARGUMENTS_ADAPTOR: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginArgumentsAdaptorFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case STUB:
- translation->BeginCompiledStubFrame(translation_size);
- break;
- }
+ WriteTranslationFrame(environment, translation);
int object_index = 0;
int dematerialized_index = 0;
}
-int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) {
- int result = deoptimization_literals_.length();
- for (int i = 0; i < deoptimization_literals_.length(); ++i) {
- if (deoptimization_literals_[i].is_identical_to(literal)) return i;
- }
- deoptimization_literals_.Add(literal, zone());
- return result;
-}
-
-
void LCodeGen::RegisterEnvironmentForDeoptimization(LEnvironment* environment,
Safepoint::DeoptMode mode) {
environment->set_has_been_used();
: LCodeGenBase(chunk, assembler, info),
deoptimizations_(4, info->zone()),
jump_table_(4, info->zone()),
- deoptimization_literals_(8, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
translations_(info->zone()),
Condition EmitIsString(Register input, Register temp1, Label* is_not_string,
SmiCheck check_needed);
- int DefineDeoptimizationLiteral(Handle<Object> literal);
void PopulateDeoptimizationData(Handle<Code> code);
void PopulateDeoptimizationLiteralsWithInlinedFunctions();
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry*> jump_table_;
- ZoneList<Handle<Object> > deoptimization_literals_;
int inlined_function_count_;
Scope* const scope_;
TranslationBuffer translations_;
// The translation includes one command per value in the environment.
int translation_size = environment->translation_size();
- // The output frame height does not include the parameters.
- int height = translation_size - environment->parameter_count();
WriteTranslation(environment->outer(), translation);
-
- switch (environment->frame_type()) {
- case JS_FUNCTION: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginJSFrame(environment->ast_id(), shared_id, height);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_CONSTRUCT: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginConstructStubFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_GETTER: {
- DCHECK(translation_size == 1);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginGetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_SETTER: {
- DCHECK(translation_size == 2);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginSetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case ARGUMENTS_ADAPTOR: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginArgumentsAdaptorFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case STUB:
- translation->BeginCompiledStubFrame(translation_size);
- break;
- }
+ WriteTranslationFrame(environment, translation);
int object_index = 0;
int dematerialized_index = 0;
}
-int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) {
- int result = deoptimization_literals_.length();
- for (int i = 0; i < deoptimization_literals_.length(); ++i) {
- if (deoptimization_literals_[i].is_identical_to(literal)) return i;
- }
- deoptimization_literals_.Add(literal, zone());
- return result;
-}
-
-
void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
DCHECK_EQ(0, deoptimization_literals_.length());
for (auto function : chunk()->inlined_functions()) {
: LCodeGenBase(chunk, assembler, info),
deoptimizations_(4, info->zone()),
jump_table_(4, info->zone()),
- deoptimization_literals_(8, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
translations_(info->zone()),
int* object_index_pointer,
int* dematerialized_index_pointer);
void PopulateDeoptimizationData(Handle<Code> code);
- int DefineDeoptimizationLiteral(Handle<Object> literal);
void PopulateDeoptimizationLiteralsWithInlinedFunctions();
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry> jump_table_;
- ZoneList<Handle<Object> > deoptimization_literals_;
int inlined_function_count_;
Scope* const scope_;
TranslationBuffer translations_;
}
-LCodeGenBase::LCodeGenBase(LChunk* chunk,
- MacroAssembler* assembler,
+LCodeGenBase::LCodeGenBase(LChunk* chunk, MacroAssembler* assembler,
CompilationInfo* info)
: chunk_(static_cast<LPlatformChunk*>(chunk)),
masm_(assembler),
current_block_(-1),
current_instruction_(-1),
instructions_(chunk->instructions()),
- last_lazy_deopt_pc_(0) {
-}
+ deoptimization_literals_(8, info->zone()),
+ last_lazy_deopt_pc_(0) {}
bool LCodeGenBase::GenerateBody() {
}
+int LCodeGenBase::DefineDeoptimizationLiteral(Handle<Object> literal) {
+ int result = deoptimization_literals_.length();
+ for (int i = 0; i < deoptimization_literals_.length(); ++i) {
+ if (deoptimization_literals_[i].is_identical_to(literal)) return i;
+ }
+ deoptimization_literals_.Add(literal, zone());
+ return result;
+}
+
+
+void LCodeGenBase::WriteTranslationFrame(LEnvironment* environment,
+ Translation* translation) {
+ int translation_size = environment->translation_size();
+ // The output frame height does not include the parameters.
+ int height = translation_size - environment->parameter_count();
+
+ switch (environment->frame_type()) {
+ case JS_FUNCTION: {
+ int shared_id = DefineDeoptimizationLiteral(
+ environment->entry() ? environment->entry()->shared()
+ : info()->shared_info());
+ translation->BeginJSFrame(environment->ast_id(), shared_id, height);
+ if (info()->closure().is_identical_to(environment->closure())) {
+ translation->StoreJSFrameFunction();
+ } else {
+ int closure_id = DefineDeoptimizationLiteral(environment->closure());
+ translation->StoreLiteral(closure_id);
+ }
+ break;
+ }
+ case JS_CONSTRUCT: {
+ int shared_id = DefineDeoptimizationLiteral(
+ environment->entry() ? environment->entry()->shared()
+ : info()->shared_info());
+ translation->BeginConstructStubFrame(shared_id, translation_size);
+ if (info()->closure().is_identical_to(environment->closure())) {
+ translation->StoreJSFrameFunction();
+ } else {
+ int closure_id = DefineDeoptimizationLiteral(environment->closure());
+ translation->StoreLiteral(closure_id);
+ }
+ break;
+ }
+ case JS_GETTER: {
+ DCHECK(translation_size == 1);
+ DCHECK(height == 0);
+ int shared_id = DefineDeoptimizationLiteral(
+ environment->entry() ? environment->entry()->shared()
+ : info()->shared_info());
+ translation->BeginGetterStubFrame(shared_id);
+ if (info()->closure().is_identical_to(environment->closure())) {
+ translation->StoreJSFrameFunction();
+ } else {
+ int closure_id = DefineDeoptimizationLiteral(environment->closure());
+ translation->StoreLiteral(closure_id);
+ }
+ break;
+ }
+ case JS_SETTER: {
+ DCHECK(translation_size == 2);
+ DCHECK(height == 0);
+ int shared_id = DefineDeoptimizationLiteral(
+ environment->entry() ? environment->entry()->shared()
+ : info()->shared_info());
+ translation->BeginSetterStubFrame(shared_id);
+ if (info()->closure().is_identical_to(environment->closure())) {
+ translation->StoreJSFrameFunction();
+ } else {
+ int closure_id = DefineDeoptimizationLiteral(environment->closure());
+ translation->StoreLiteral(closure_id);
+ }
+ break;
+ }
+ case ARGUMENTS_ADAPTOR: {
+ int shared_id = DefineDeoptimizationLiteral(
+ environment->entry() ? environment->entry()->shared()
+ : info()->shared_info());
+ translation->BeginArgumentsAdaptorFrame(shared_id, translation_size);
+ if (info()->closure().is_identical_to(environment->closure())) {
+ translation->StoreJSFrameFunction();
+ } else {
+ int closure_id = DefineDeoptimizationLiteral(environment->closure());
+ translation->StoreLiteral(closure_id);
+ }
+ break;
+ }
+ case STUB:
+ translation->BeginCompiledStubFrame(translation_size);
+ break;
+ }
+}
+
+
Deoptimizer::DeoptInfo LCodeGenBase::MakeDeoptInfo(
LInstruction* instr, Deoptimizer::DeoptReason deopt_reason) {
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
namespace v8 {
namespace internal {
+class LEnvironment;
class LInstruction;
class LPlatformChunk;
void RegisterWeakObjectsInOptimizedCode(Handle<Code> code);
+ void WriteTranslationFrame(LEnvironment* environment,
+ Translation* translation);
+ int DefineDeoptimizationLiteral(Handle<Object> literal);
+
// Check that an environment assigned via AssignEnvironment is actually being
// used. Redundant assignments keep things alive longer than necessary, and
// consequently lead to worse code, so it's important to minimize this.
int current_block_;
int current_instruction_;
const ZoneList<LInstruction*>* instructions_;
+ ZoneList<Handle<Object> > deoptimization_literals_;
int last_lazy_deopt_pc_;
bool is_unused() const { return status_ == UNUSED; }
// The translation includes one command per value in the environment.
int translation_size = environment->translation_size();
- // The output frame height does not include the parameters.
- int height = translation_size - environment->parameter_count();
WriteTranslation(environment->outer(), translation);
-
- switch (environment->frame_type()) {
- case JS_FUNCTION: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginJSFrame(environment->ast_id(), shared_id, height);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_CONSTRUCT: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginConstructStubFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_GETTER: {
- DCHECK(translation_size == 1);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginGetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_SETTER: {
- DCHECK(translation_size == 2);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginSetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case ARGUMENTS_ADAPTOR: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginArgumentsAdaptorFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case STUB:
- translation->BeginCompiledStubFrame(translation_size);
- break;
- }
+ WriteTranslationFrame(environment, translation);
int object_index = 0;
int dematerialized_index = 0;
}
-int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) {
- int result = deoptimization_literals_.length();
- for (int i = 0; i < deoptimization_literals_.length(); ++i) {
- if (deoptimization_literals_[i].is_identical_to(literal)) return i;
- }
- deoptimization_literals_.Add(literal, zone());
- return result;
-}
-
-
void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
DCHECK_EQ(0, deoptimization_literals_.length());
for (auto function : chunk()->inlined_functions()) {
: LCodeGenBase(chunk, assembler, info),
deoptimizations_(4, info->zone()),
jump_table_(4, info->zone()),
- deoptimization_literals_(8, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
translations_(info->zone()),
int* object_index_pointer,
int* dematerialized_index_pointer);
void PopulateDeoptimizationData(Handle<Code> code);
- int DefineDeoptimizationLiteral(Handle<Object> literal);
void PopulateDeoptimizationLiteralsWithInlinedFunctions();
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry> jump_table_;
- ZoneList<Handle<Object> > deoptimization_literals_;
int inlined_function_count_;
Scope* const scope_;
TranslationBuffer translations_;
// The translation includes one command per value in the environment.
int translation_size = environment->translation_size();
- // The output frame height does not include the parameters.
- int height = translation_size - environment->parameter_count();
WriteTranslation(environment->outer(), translation);
-
- switch (environment->frame_type()) {
- case JS_FUNCTION: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginJSFrame(environment->ast_id(), shared_id, height);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_CONSTRUCT: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginConstructStubFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_GETTER: {
- DCHECK(translation_size == 1);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginGetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_SETTER: {
- DCHECK(translation_size == 2);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginSetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case ARGUMENTS_ADAPTOR: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginArgumentsAdaptorFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case STUB:
- translation->BeginCompiledStubFrame(translation_size);
- break;
- }
+ WriteTranslationFrame(environment, translation);
int object_index = 0;
int dematerialized_index = 0;
}
-int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) {
- int result = deoptimization_literals_.length();
- for (int i = 0; i < deoptimization_literals_.length(); ++i) {
- if (deoptimization_literals_[i].is_identical_to(literal)) return i;
- }
- deoptimization_literals_.Add(literal, zone());
- return result;
-}
-
-
void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
DCHECK_EQ(0, deoptimization_literals_.length());
for (auto function : chunk()->inlined_functions()) {
: LCodeGenBase(chunk, assembler, info),
deoptimizations_(4, info->zone()),
jump_table_(4, info->zone()),
- deoptimization_literals_(8, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
translations_(info->zone()),
int* object_index_pointer,
int* dematerialized_index_pointer);
void PopulateDeoptimizationData(Handle<Code> code);
- int DefineDeoptimizationLiteral(Handle<Object> literal);
void PopulateDeoptimizationLiteralsWithInlinedFunctions();
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry*> jump_table_;
- ZoneList<Handle<Object> > deoptimization_literals_;
int inlined_function_count_;
Scope* const scope_;
TranslationBuffer translations_;
// The translation includes one command per value in the environment.
int translation_size = environment->translation_size();
- // The output frame height does not include the parameters.
- int height = translation_size - environment->parameter_count();
WriteTranslation(environment->outer(), translation);
-
- switch (environment->frame_type()) {
- case JS_FUNCTION: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginJSFrame(environment->ast_id(), shared_id, height);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_CONSTRUCT: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginConstructStubFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_GETTER: {
- DCHECK(translation_size == 1);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginGetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_SETTER: {
- DCHECK(translation_size == 2);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginSetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case ARGUMENTS_ADAPTOR: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginArgumentsAdaptorFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case STUB:
- translation->BeginCompiledStubFrame(translation_size);
- break;
- }
+ WriteTranslationFrame(environment, translation);
int object_index = 0;
int dematerialized_index = 0;
}
-int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) {
- int result = deoptimization_literals_.length();
- for (int i = 0; i < deoptimization_literals_.length(); ++i) {
- if (deoptimization_literals_[i].is_identical_to(literal)) return i;
- }
- deoptimization_literals_.Add(literal, zone());
- return result;
-}
-
-
void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
DCHECK_EQ(0, deoptimization_literals_.length());
for (auto function : chunk()->inlined_functions()) {
: LCodeGenBase(chunk, assembler, info),
deoptimizations_(4, info->zone()),
jump_table_(4, info->zone()),
- deoptimization_literals_(8, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
translations_(info->zone()),
int* object_index_pointer,
int* dematerialized_index_pointer);
void PopulateDeoptimizationData(Handle<Code> code);
- int DefineDeoptimizationLiteral(Handle<Object> literal);
void PopulateDeoptimizationLiteralsWithInlinedFunctions();
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry> jump_table_;
- ZoneList<Handle<Object> > deoptimization_literals_;
int inlined_function_count_;
Scope* const scope_;
TranslationBuffer translations_;
// The translation includes one command per value in the environment.
int translation_size = environment->translation_size();
- // The output frame height does not include the parameters.
- int height = translation_size - environment->parameter_count();
WriteTranslation(environment->outer(), translation);
-
- switch (environment->frame_type()) {
- case JS_FUNCTION: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginJSFrame(environment->ast_id(), shared_id, height);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_CONSTRUCT: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginConstructStubFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_GETTER: {
- DCHECK(translation_size == 1);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginGetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case JS_SETTER: {
- DCHECK(translation_size == 2);
- DCHECK(height == 0);
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginSetterStubFrame(shared_id);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case ARGUMENTS_ADAPTOR: {
- int shared_id = DefineDeoptimizationLiteral(
- environment->entry() ? environment->entry()->shared()
- : info()->shared_info());
- translation->BeginArgumentsAdaptorFrame(shared_id, translation_size);
- if (info()->closure().is_identical_to(environment->closure())) {
- translation->StoreJSFrameFunction();
- } else {
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
- translation->StoreLiteral(closure_id);
- }
- break;
- }
- case STUB:
- translation->BeginCompiledStubFrame(translation_size);
- break;
- }
+ WriteTranslationFrame(environment, translation);
int object_index = 0;
int dematerialized_index = 0;
}
-int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) {
- int result = deoptimization_literals_.length();
- for (int i = 0; i < deoptimization_literals_.length(); ++i) {
- if (deoptimization_literals_[i].is_identical_to(literal)) return i;
- }
- deoptimization_literals_.Add(literal, zone());
- return result;
-}
-
-
void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
DCHECK_EQ(0, deoptimization_literals_.length());
for (auto function : chunk()->inlined_functions()) {
: LCodeGenBase(chunk, assembler, info),
deoptimizations_(4, info->zone()),
jump_table_(4, info->zone()),
- deoptimization_literals_(8, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
translations_(info->zone()),
int* object_index_pointer,
int* dematerialized_index_pointer);
void PopulateDeoptimizationData(Handle<Code> code);
- int DefineDeoptimizationLiteral(Handle<Object> literal);
void PopulateDeoptimizationLiteralsWithInlinedFunctions();
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry> jump_table_;
- ZoneList<Handle<Object> > deoptimization_literals_;
int inlined_function_count_;
Scope* const scope_;
TranslationBuffer translations_;
// The translation includes one command per value in the environment.
int translation_size = environment->translation_size();
- // The output frame height does not include the parameters.
- int height = translation_size - environment->parameter_count();
WriteTranslation(environment->outer(), translation);
- bool has_closure_id = !info()->closure().is_null() &&
- !info()->closure().is_identical_to(environment->closure());
- int closure_id = has_closure_id
- ? DefineDeoptimizationLiteral(environment->closure())
- : Translation::kSelfLiteralId;
- switch (environment->frame_type()) {
- case JS_FUNCTION:
- translation->BeginJSFrame(environment->ast_id(), closure_id, height);
- break;
- case JS_CONSTRUCT:
- translation->BeginConstructStubFrame(closure_id, translation_size);
- break;
- case JS_GETTER:
- DCHECK(translation_size == 1);
- DCHECK(height == 0);
- translation->BeginGetterStubFrame(closure_id);
- break;
- case JS_SETTER:
- DCHECK(translation_size == 2);
- DCHECK(height == 0);
- translation->BeginSetterStubFrame(closure_id);
- break;
- case ARGUMENTS_ADAPTOR:
- translation->BeginArgumentsAdaptorFrame(closure_id, translation_size);
- break;
- case STUB:
- translation->BeginCompiledStubFrame(translation_size);
- break;
- default:
- UNREACHABLE();
- }
+ WriteTranslationFrame(environment, translation);
int object_index = 0;
int dematerialized_index = 0;
}
-int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) {
- int result = deoptimization_literals_.length();
- for (int i = 0; i < deoptimization_literals_.length(); ++i) {
- if (deoptimization_literals_[i].is_identical_to(literal)) return i;
- }
- deoptimization_literals_.Add(literal, zone());
- return result;
-}
-
-
void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
DCHECK_EQ(0, deoptimization_literals_.length());
for (auto function : chunk()->inlined_functions()) {
: LCodeGenBase(chunk, assembler, info),
deoptimizations_(4, info->zone()),
jump_table_(4, info->zone()),
- deoptimization_literals_(8, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
translations_(info->zone()),
int* object_index_pointer,
int* dematerialized_index_pointer);
void PopulateDeoptimizationData(Handle<Code> code);
- int DefineDeoptimizationLiteral(Handle<Object> literal);
void PopulateDeoptimizationLiteralsWithInlinedFunctions();
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry> jump_table_;
- ZoneList<Handle<Object> > deoptimization_literals_;
int inlined_function_count_;
Scope* const scope_;
TranslationBuffer translations_;