Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/x87/full-codegen-x87.cc

Issue 1157213004: Drop computed handler count and index from AST. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/mjsunit/regress/regress-crbug-493290.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // The live registers are: 86 // The live registers are:
87 // o edi: the JS function object being called (i.e. ourselves) 87 // o edi: the JS function object being called (i.e. ourselves)
88 // o esi: our context 88 // o esi: our context
89 // o ebp: our caller's frame pointer 89 // o ebp: our caller's frame pointer
90 // o esp: stack pointer (pointing to return address) 90 // o esp: stack pointer (pointing to return address)
91 // 91 //
92 // The function builds a JS frame. Please see JavaScriptFrameConstants in 92 // The function builds a JS frame. Please see JavaScriptFrameConstants in
93 // frames-x87.h for its layout. 93 // frames-x87.h for its layout.
94 void FullCodeGenerator::Generate() { 94 void FullCodeGenerator::Generate() {
95 CompilationInfo* info = info_; 95 CompilationInfo* info = info_;
96 handler_table_ =
97 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray(
98 HandlerTable::LengthForRange(function()->handler_count()), TENURED));
99
100 profiling_counter_ = isolate()->factory()->NewCell( 96 profiling_counter_ = isolate()->factory()->NewCell(
101 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); 97 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate()));
102 SetFunctionPosition(function()); 98 SetFunctionPosition(function());
103 Comment cmnt(masm_, "[ function compiled by full code generator"); 99 Comment cmnt(masm_, "[ function compiled by full code generator");
104 100
105 ProfileEntryHookStub::MaybeCallEntryHook(masm_); 101 ProfileEntryHookStub::MaybeCallEntryHook(masm_);
106 102
107 #ifdef DEBUG 103 #ifdef DEBUG
108 if (strlen(FLAG_stop_at) > 0 && 104 if (strlen(FLAG_stop_at) > 0 &&
109 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { 105 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
(...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 __ push(load_name); // "throw" 2090 __ push(load_name); // "throw"
2095 __ push(Operand(esp, 2 * kPointerSize)); // iter 2091 __ push(Operand(esp, 2 * kPointerSize)); // iter
2096 __ push(eax); // exception 2092 __ push(eax); // exception
2097 __ jmp(&l_call); 2093 __ jmp(&l_call);
2098 2094
2099 // try { received = %yield result } 2095 // try { received = %yield result }
2100 // Shuffle the received result above a try handler and yield it without 2096 // Shuffle the received result above a try handler and yield it without
2101 // re-boxing. 2097 // re-boxing.
2102 __ bind(&l_try); 2098 __ bind(&l_try);
2103 __ pop(eax); // result 2099 __ pop(eax); // result
2104 EnterTryBlock(expr->index(), &l_catch); 2100 int handler_index = NewHandlerTableEntry();
2101 EnterTryBlock(handler_index, &l_catch);
2105 const int try_block_size = TryCatch::kElementCount * kPointerSize; 2102 const int try_block_size = TryCatch::kElementCount * kPointerSize;
2106 __ push(eax); // result 2103 __ push(eax); // result
2107 __ jmp(&l_suspend); 2104 __ jmp(&l_suspend);
2108 __ bind(&l_continuation); 2105 __ bind(&l_continuation);
2109 __ jmp(&l_resume); 2106 __ jmp(&l_resume);
2110 __ bind(&l_suspend); 2107 __ bind(&l_suspend);
2111 const int generator_object_depth = kPointerSize + try_block_size; 2108 const int generator_object_depth = kPointerSize + try_block_size;
2112 __ mov(eax, Operand(esp, generator_object_depth)); 2109 __ mov(eax, Operand(esp, generator_object_depth));
2113 __ push(eax); // g 2110 __ push(eax); // g
2114 __ push(Immediate(Smi::FromInt(expr->index()))); // handler-index 2111 __ push(Immediate(Smi::FromInt(handler_index))); // handler-index
2115 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); 2112 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos()));
2116 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), 2113 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset),
2117 Immediate(Smi::FromInt(l_continuation.pos()))); 2114 Immediate(Smi::FromInt(l_continuation.pos())));
2118 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); 2115 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi);
2119 __ mov(ecx, esi); 2116 __ mov(ecx, esi);
2120 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, 2117 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx,
2121 kDontSaveFPRegs); 2118 kDontSaveFPRegs);
2122 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2); 2119 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2);
2123 __ mov(context_register(), 2120 __ mov(context_register(),
2124 Operand(ebp, StandardFrameConstants::kContextOffset)); 2121 Operand(ebp, StandardFrameConstants::kContextOffset));
2125 __ pop(eax); // result 2122 __ pop(eax); // result
2126 EmitReturnSequence(); 2123 EmitReturnSequence();
2127 __ bind(&l_resume); // received in eax 2124 __ bind(&l_resume); // received in eax
2128 ExitTryBlock(expr->index()); 2125 ExitTryBlock(handler_index);
2129 2126
2130 // receiver = iter; f = iter.next; arg = received; 2127 // receiver = iter; f = iter.next; arg = received;
2131 __ bind(&l_next); 2128 __ bind(&l_next);
2132 2129
2133 __ mov(load_name, isolate()->factory()->next_string()); 2130 __ mov(load_name, isolate()->factory()->next_string());
2134 __ push(load_name); // "next" 2131 __ push(load_name); // "next"
2135 __ push(Operand(esp, 2 * kPointerSize)); // iter 2132 __ push(Operand(esp, 2 * kPointerSize)); // iter
2136 __ push(eax); // received 2133 __ push(eax); // received
2137 2134
2138 // result = receiver[f](arg); 2135 // result = receiver[f](arg);
(...skipping 3268 matching lines...) Expand 10 before | Expand all | Expand 10 after
5407 Assembler::target_address_at(call_target_address, 5404 Assembler::target_address_at(call_target_address,
5408 unoptimized_code)); 5405 unoptimized_code));
5409 return OSR_AFTER_STACK_CHECK; 5406 return OSR_AFTER_STACK_CHECK;
5410 } 5407 }
5411 5408
5412 5409
5413 } // namespace internal 5410 } // namespace internal
5414 } // namespace v8 5411 } // namespace v8
5415 5412
5416 #endif // V8_TARGET_ARCH_X87 5413 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/mjsunit/regress/regress-crbug-493290.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698