From c051ef383d1c97ec46b23efdd498469c70249ba5 Mon Sep 17 00:00:00 2001 From: neis Date: Tue, 22 Nov 2016 05:48:32 -0800 Subject: [PATCH] Remove some leftovers of full-codegen's generators implementation. TBR=littledan@chromium.org BUG= Review-Url: https://codereview.chromium.org/2517143003 Cr-Commit-Position: refs/heads/master@{#41180} --- src/arm/assembler-arm.h | 3 --- src/arm64/assembler-arm64.cc | 6 ++--- src/arm64/assembler-arm64.h | 3 --- src/assembler.cc | 9 ------- src/assembler.h | 6 ----- src/debug/debug.cc | 23 ++++------------ src/full-codegen/arm/full-codegen-arm.cc | 2 -- src/full-codegen/arm64/full-codegen-arm64.cc | 2 -- src/full-codegen/ia32/full-codegen-ia32.cc | 2 -- src/full-codegen/mips/full-codegen-mips.cc | 2 -- .../mips64/full-codegen-mips64.cc | 2 -- src/full-codegen/ppc/full-codegen-ppc.cc | 2 -- src/full-codegen/s390/full-codegen-s390.cc | 2 -- src/full-codegen/x64/full-codegen-x64.cc | 2 -- src/full-codegen/x87/full-codegen-x87.cc | 2 -- src/ia32/assembler-ia32.h | 3 --- src/mips/assembler-mips.h | 3 --- src/mips64/assembler-mips64.h | 3 --- src/objects.cc | 26 ++++++------------- src/objects.h | 3 +-- src/parsing/parser.cc | 8 +++--- src/ppc/assembler-ppc.h | 3 --- src/s390/assembler-s390.h | 3 --- src/x64/assembler-x64.h | 3 --- src/x87/assembler-x87.h | 3 --- 25 files changed, 20 insertions(+), 106 deletions(-) diff --git a/src/arm/assembler-arm.h b/src/arm/assembler-arm.h index 1283c3984a..d48d217093 100644 --- a/src/arm/assembler-arm.h +++ b/src/arm/assembler-arm.h @@ -1395,9 +1395,6 @@ class Assembler : public AssemblerBase { // Debugging - // Mark generator continuation. - void RecordGeneratorContinuation(); - // Mark address of a debug break slot. void RecordDebugBreakSlot(RelocInfo::Mode mode); diff --git a/src/arm64/assembler-arm64.cc b/src/arm64/assembler-arm64.cc index 37fdb2618f..423d81508e 100644 --- a/src/arm64/assembler-arm64.cc +++ b/src/arm64/assembler-arm64.cc @@ -2950,15 +2950,13 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { (rmode == RelocInfo::CONST_POOL) || (rmode == RelocInfo::VENEER_POOL) || (rmode == RelocInfo::DEOPT_SCRIPT_OFFSET) || (rmode == RelocInfo::DEOPT_INLINING_ID) || - (rmode == RelocInfo::DEOPT_REASON) || (rmode == RelocInfo::DEOPT_ID) || - (rmode == RelocInfo::GENERATOR_CONTINUATION)) { + (rmode == RelocInfo::DEOPT_REASON) || (rmode == RelocInfo::DEOPT_ID)) { // Adjust code for new modes. DCHECK(RelocInfo::IsDebugBreakSlot(rmode) || RelocInfo::IsComment(rmode) || RelocInfo::IsDeoptReason(rmode) || RelocInfo::IsDeoptId(rmode) || RelocInfo::IsDeoptPosition(rmode) || RelocInfo::IsInternalReference(rmode) || - RelocInfo::IsConstPool(rmode) || RelocInfo::IsVeneerPool(rmode) || - RelocInfo::IsGeneratorContinuation(rmode)); + RelocInfo::IsConstPool(rmode) || RelocInfo::IsVeneerPool(rmode)); // These modes do not need an entry in the constant pool. } else { constpool_.RecordEntry(data, rmode); diff --git a/src/arm64/assembler-arm64.h b/src/arm64/assembler-arm64.h index d5c2936dc2..a55f8138f2 100644 --- a/src/arm64/assembler-arm64.h +++ b/src/arm64/assembler-arm64.h @@ -938,9 +938,6 @@ class Assembler : public AssemblerBase { int buffer_space() const; - // Mark generator continuation. - void RecordGeneratorContinuation(); - // Mark address of a debug break slot. void RecordDebugBreakSlot(RelocInfo::Mode mode); diff --git a/src/assembler.cc b/src/assembler.cc index a2c0ebebaf..6f6991523d 100644 --- a/src/assembler.cc +++ b/src/assembler.cc @@ -782,8 +782,6 @@ const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) { return "debug break slot at tail call"; case CODE_AGE_SEQUENCE: return "code age sequence"; - case GENERATOR_CONTINUATION: - return "generator continuation"; case WASM_MEMORY_REFERENCE: return "wasm memory reference"; case WASM_MEMORY_SIZE_REFERENCE: @@ -884,7 +882,6 @@ void RelocInfo::Verify(Isolate* isolate) { case DEBUG_BREAK_SLOT_AT_RETURN: case DEBUG_BREAK_SLOT_AT_CALL: case DEBUG_BREAK_SLOT_AT_TAIL_CALL: - case GENERATOR_CONTINUATION: case WASM_MEMORY_REFERENCE: case WASM_MEMORY_SIZE_REFERENCE: case WASM_GLOBAL_REFERENCE: @@ -1914,12 +1911,6 @@ void Assembler::RecordComment(const char* msg) { } -void Assembler::RecordGeneratorContinuation() { - EnsureSpace ensure_space(this); - RecordRelocInfo(RelocInfo::GENERATOR_CONTINUATION); -} - - void Assembler::RecordDebugBreakSlot(RelocInfo::Mode mode) { EnsureSpace ensure_space(this); DCHECK(RelocInfo::IsDebugBreakSlot(mode)); diff --git a/src/assembler.h b/src/assembler.h index 2169b15c1d..ff6bfd48f2 100644 --- a/src/assembler.h +++ b/src/assembler.h @@ -413,9 +413,6 @@ class RelocInfo { // Encoded internal reference, used only on MIPS, MIPS64 and PPC. INTERNAL_REFERENCE_ENCODED, - // Continuation points for a generator yield. - GENERATOR_CONTINUATION, - // Marks constant and veneer pools. Only used on ARM and ARM64. // They use a custom noncompact encoding. CONST_POOL, @@ -524,9 +521,6 @@ class RelocInfo { static inline bool IsCodeAgeSequence(Mode mode) { return mode == CODE_AGE_SEQUENCE; } - static inline bool IsGeneratorContinuation(Mode mode) { - return mode == GENERATOR_CONTINUATION; - } static inline bool IsWasmMemoryReference(Mode mode) { return mode == WASM_MEMORY_REFERENCE; } diff --git a/src/debug/debug.cc b/src/debug/debug.cc index 019f3732ce..87dd50d300 100644 --- a/src/debug/debug.cc +++ b/src/debug/debug.cc @@ -1178,29 +1178,15 @@ static Address ComputeNewPcForRedirect(Code* new_code, Code* old_code, // Count the number of continuations at which the current pc offset is at. static int ComputeContinuationIndexFromPcOffset(Code* code, int pc_offset) { - DCHECK_EQ(code->kind(), Code::FUNCTION); - Address pc = code->instruction_start() + pc_offset; - int mask = RelocInfo::ModeMask(RelocInfo::GENERATOR_CONTINUATION); - int index = 0; - for (RelocIterator it(code, mask); !it.done(); it.next()) { - index++; - RelocInfo* rinfo = it.rinfo(); - Address current_pc = rinfo->pc(); - if (current_pc == pc) break; - DCHECK(current_pc < pc); - } - return index; + UNREACHABLE(); + return 666; } // Find the pc offset for the given continuation index. static int ComputePcOffsetFromContinuationIndex(Code* code, int index) { - DCHECK_EQ(code->kind(), Code::FUNCTION); - DCHECK(code->has_debug_break_slots()); - int mask = RelocInfo::ModeMask(RelocInfo::GENERATOR_CONTINUATION); - RelocIterator it(code, mask); - for (int i = 1; i < index; i++) it.next(); - return static_cast(it.rinfo()->pc() - code->instruction_start()); + UNREACHABLE(); + return 666; } @@ -1293,6 +1279,7 @@ bool Debug::PrepareFunctionForBreakPoints(Handle shared) { HeapIterator iterator(isolate_->heap()); HeapObject* obj; // Continuation from old-style generators need to be recomputed. + // TODO(yangguo): Remove code for old-style generators. bool find_resumables = baseline_exists && IsResumableFunction(shared->kind()); diff --git a/src/full-codegen/arm/full-codegen-arm.cc b/src/full-codegen/arm/full-codegen-arm.cc index 9370ef3328..34c2684571 100644 --- a/src/full-codegen/arm/full-codegen-arm.cc +++ b/src/full-codegen/arm/full-codegen-arm.cc @@ -144,8 +144,6 @@ void FullCodeGenerator::Generate() { { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = info->scope()->num_stack_slots(); - // Generators allocate locals, if any, in context slots. - DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); OperandStackDepthIncrement(locals_count); if (locals_count > 0) { if (locals_count >= 128) { diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc b/src/full-codegen/arm64/full-codegen-arm64.cc index 35fe756638..c3e50005da 100644 --- a/src/full-codegen/arm64/full-codegen-arm64.cc +++ b/src/full-codegen/arm64/full-codegen-arm64.cc @@ -149,8 +149,6 @@ void FullCodeGenerator::Generate() { // Reserve space on the stack for locals. { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = info->scope()->num_stack_slots(); - // Generators allocate locals, if any, in context slots. - DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); OperandStackDepthIncrement(locals_count); if (locals_count > 0) { if (locals_count >= 128) { diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc index b279b9e1aa..87840f7488 100644 --- a/src/full-codegen/ia32/full-codegen-ia32.cc +++ b/src/full-codegen/ia32/full-codegen-ia32.cc @@ -130,8 +130,6 @@ void FullCodeGenerator::Generate() { { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = info->scope()->num_stack_slots(); - // Generators allocate locals, if any, in context slots. - DCHECK(!IsGeneratorFunction(literal()->kind()) || locals_count == 0); OperandStackDepthIncrement(locals_count); if (locals_count == 1) { __ push(Immediate(isolate()->factory()->undefined_value())); diff --git a/src/full-codegen/mips/full-codegen-mips.cc b/src/full-codegen/mips/full-codegen-mips.cc index 10196039ed..261494b60d 100644 --- a/src/full-codegen/mips/full-codegen-mips.cc +++ b/src/full-codegen/mips/full-codegen-mips.cc @@ -153,8 +153,6 @@ void FullCodeGenerator::Generate() { { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = info->scope()->num_stack_slots(); - // Generators allocate locals, if any, in context slots. - DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); OperandStackDepthIncrement(locals_count); if (locals_count > 0) { if (locals_count >= 128) { diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc b/src/full-codegen/mips64/full-codegen-mips64.cc index 69677b0b65..bca1afc3b6 100644 --- a/src/full-codegen/mips64/full-codegen-mips64.cc +++ b/src/full-codegen/mips64/full-codegen-mips64.cc @@ -152,8 +152,6 @@ void FullCodeGenerator::Generate() { { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = info->scope()->num_stack_slots(); - // Generators allocate locals, if any, in context slots. - DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); OperandStackDepthIncrement(locals_count); if (locals_count > 0) { if (locals_count >= 128) { diff --git a/src/full-codegen/ppc/full-codegen-ppc.cc b/src/full-codegen/ppc/full-codegen-ppc.cc index f014951ca5..8997778622 100644 --- a/src/full-codegen/ppc/full-codegen-ppc.cc +++ b/src/full-codegen/ppc/full-codegen-ppc.cc @@ -152,8 +152,6 @@ void FullCodeGenerator::Generate() { { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = info->scope()->num_stack_slots(); - // Generators allocate locals, if any, in context slots. - DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); OperandStackDepthIncrement(locals_count); if (locals_count > 0) { if (locals_count >= 128) { diff --git a/src/full-codegen/s390/full-codegen-s390.cc b/src/full-codegen/s390/full-codegen-s390.cc index 531ca051d2..6efc0f1ace 100644 --- a/src/full-codegen/s390/full-codegen-s390.cc +++ b/src/full-codegen/s390/full-codegen-s390.cc @@ -151,8 +151,6 @@ void FullCodeGenerator::Generate() { { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = info->scope()->num_stack_slots(); - // Generators allocate locals, if any, in context slots. - DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); OperandStackDepthIncrement(locals_count); if (locals_count > 0) { if (locals_count >= 128) { diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc index c0c8a3b953..9142c18a08 100644 --- a/src/full-codegen/x64/full-codegen-x64.cc +++ b/src/full-codegen/x64/full-codegen-x64.cc @@ -131,8 +131,6 @@ void FullCodeGenerator::Generate() { { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = info->scope()->num_stack_slots(); - // Generators allocate locals, if any, in context slots. - DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); OperandStackDepthIncrement(locals_count); if (locals_count == 1) { __ PushRoot(Heap::kUndefinedValueRootIndex); diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc index 95167516b8..daaabdb8f4 100644 --- a/src/full-codegen/x87/full-codegen-x87.cc +++ b/src/full-codegen/x87/full-codegen-x87.cc @@ -130,8 +130,6 @@ void FullCodeGenerator::Generate() { { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = info->scope()->num_stack_slots(); - // Generators allocate locals, if any, in context slots. - DCHECK(!IsGeneratorFunction(literal()->kind()) || locals_count == 0); OperandStackDepthIncrement(locals_count); if (locals_count == 1) { __ push(Immediate(isolate()->factory()->undefined_value())); diff --git a/src/ia32/assembler-ia32.h b/src/ia32/assembler-ia32.h index 79f4125354..ddee696162 100644 --- a/src/ia32/assembler-ia32.h +++ b/src/ia32/assembler-ia32.h @@ -1434,9 +1434,6 @@ class Assembler : public AssemblerBase { return pc_offset() - label->pos(); } - // Mark generator continuation. - void RecordGeneratorContinuation(); - // Mark address of a debug break slot. void RecordDebugBreakSlot(RelocInfo::Mode mode); diff --git a/src/mips/assembler-mips.h b/src/mips/assembler-mips.h index 1df6e3f5ad..965c0cdc29 100644 --- a/src/mips/assembler-mips.h +++ b/src/mips/assembler-mips.h @@ -1029,9 +1029,6 @@ class Assembler : public AssemblerBase { // Debugging. - // Mark generator continuation. - void RecordGeneratorContinuation(); - // Mark address of a debug break slot. void RecordDebugBreakSlot(RelocInfo::Mode mode); diff --git a/src/mips64/assembler-mips64.h b/src/mips64/assembler-mips64.h index 056cc425f9..707fe88b74 100644 --- a/src/mips64/assembler-mips64.h +++ b/src/mips64/assembler-mips64.h @@ -1091,9 +1091,6 @@ class Assembler : public AssemblerBase { // Debugging. - // Mark generator continuation. - void RecordGeneratorContinuation(); - // Mark address of a debug break slot. void RecordDebugBreakSlot(RelocInfo::Mode mode); diff --git a/src/objects.cc b/src/objects.cc index 908ee5f40b..0625e11f61 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -19749,24 +19749,14 @@ void PropertyCell::SetValueWithInvalidation(Handle cell, int JSGeneratorObject::source_position() const { CHECK(is_suspended()); - AbstractCode* code; - int code_offset; - if (function()->shared()->HasBytecodeArray()) { - // New-style generators. - DCHECK(!function()->shared()->HasBaselineCode()); - code_offset = Smi::cast(input_or_debug_pos())->value(); - // The stored bytecode offset is relative to a different base than what - // is used in the source position table, hence the subtraction. - code_offset -= BytecodeArray::kHeaderSize - kHeapObjectTag; - code = AbstractCode::cast(function()->shared()->bytecode_array()); - } else { - // Old-style generators. - DCHECK(function()->shared()->HasBaselineCode()); - code_offset = continuation(); - CHECK(0 <= code_offset); - CHECK(code_offset < function()->code()->instruction_size()); - code = AbstractCode::cast(function()->shared()->code()); - } + DCHECK(function()->shared()->HasBytecodeArray()); + DCHECK(!function()->shared()->HasBaselineCode()); + int code_offset = Smi::cast(input_or_debug_pos())->value(); + // The stored bytecode offset is relative to a different base than what + // is used in the source position table, hence the subtraction. + code_offset -= BytecodeArray::kHeaderSize - kHeapObjectTag; + AbstractCode* code = + AbstractCode::cast(function()->shared()->bytecode_array()); return code->SourcePosition(code_offset); } diff --git a/src/objects.h b/src/objects.h index ddbb277f7b..2d873969e3 100644 --- a/src/objects.h +++ b/src/objects.h @@ -8057,8 +8057,7 @@ class JSGeneratorObject: public JSObject { // [input_or_debug_pos] // For executing generators: the most recent input value. - // For suspended new-style generators: debug information (bytecode offset). - // For suspended old-style generators: unused. + // For suspended generators: debug information (bytecode offset). // There is currently no need to remember the most recent input value for a // suspended generator. DECL_ACCESSORS(input_or_debug_pos, Object) diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc index 93bf2f471d..ba1d2581b1 100644 --- a/src/parsing/parser.cc +++ b/src/parsing/parser.cc @@ -2503,10 +2503,10 @@ void Parser::ReindexLiterals(const ParserFormalParameters& parameters) { } void Parser::PrepareGeneratorVariables(FunctionState* function_state) { - // For generators, allocating variables in contexts is currently a win - // because it minimizes the work needed to suspend and resume an - // activation. The machine code produced for generators (by full-codegen) - // relies on this forced context allocation, but not in an essential way. + // For generators, allocating variables in contexts is currently a win because + // it minimizes the work needed to suspend and resume an activation. The + // code produced for generators relies on this forced context allocation, but + // not in an essential way. scope()->ForceContextAllocation(); // Calling a generator returns a generator object. That object is stored diff --git a/src/ppc/assembler-ppc.h b/src/ppc/assembler-ppc.h index f49ac6305e..f3176049da 100644 --- a/src/ppc/assembler-ppc.h +++ b/src/ppc/assembler-ppc.h @@ -1188,9 +1188,6 @@ class Assembler : public AssemblerBase { // Debugging - // Mark generator continuation. - void RecordGeneratorContinuation(); - // Mark address of a debug break slot. void RecordDebugBreakSlot(RelocInfo::Mode mode); diff --git a/src/s390/assembler-s390.h b/src/s390/assembler-s390.h index 65f0126580..60b45fbd2f 100644 --- a/src/s390/assembler-s390.h +++ b/src/s390/assembler-s390.h @@ -1231,9 +1231,6 @@ class Assembler : public AssemblerBase { // Debugging - // Mark generator continuation. - void RecordGeneratorContinuation(); - // Mark address of a debug break slot. void RecordDebugBreakSlot(RelocInfo::Mode mode); diff --git a/src/x64/assembler-x64.h b/src/x64/assembler-x64.h index e8ee9e4bdd..08c621c938 100644 --- a/src/x64/assembler-x64.h +++ b/src/x64/assembler-x64.h @@ -1981,9 +1981,6 @@ class Assembler : public AssemblerBase { return pc_offset() - label->pos(); } - // Mark generator continuation. - void RecordGeneratorContinuation(); - // Mark address of a debug break slot. void RecordDebugBreakSlot(RelocInfo::Mode mode); diff --git a/src/x87/assembler-x87.h b/src/x87/assembler-x87.h index 160145b5ad..22339e7495 100644 --- a/src/x87/assembler-x87.h +++ b/src/x87/assembler-x87.h @@ -957,9 +957,6 @@ class Assembler : public AssemblerBase { return pc_offset() - label->pos(); } - // Mark generator continuation. - void RecordGeneratorContinuation(); - // Mark address of a debug break slot. void RecordDebugBreakSlot(RelocInfo::Mode mode);