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

Side by Side Diff: src/frames.cc

Issue 1824993002: [builtins] Add support for JS builtins written in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments Created 4 years, 9 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/crankshaft/hydrogen.cc ('k') | src/js/math.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/frames.h" 5 #include "src/frames.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopeinfo.h" 10 #include "src/ast/scopeinfo.h"
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 } else { 449 } else {
450 // Look up the code object to figure out the type of the stack frame. 450 // Look up the code object to figure out the type of the stack frame.
451 Code* code_obj = 451 Code* code_obj =
452 GetContainingCode(iterator->isolate(), *(state->pc_address)); 452 GetContainingCode(iterator->isolate(), *(state->pc_address));
453 if (code_obj != nullptr) { 453 if (code_obj != nullptr) {
454 if (code_obj->is_interpreter_entry_trampoline() || 454 if (code_obj->is_interpreter_entry_trampoline() ||
455 code_obj->is_interpreter_enter_bytecode_dispatch()) { 455 code_obj->is_interpreter_enter_bytecode_dispatch()) {
456 return INTERPRETED; 456 return INTERPRETED;
457 } 457 }
458 switch (code_obj->kind()) { 458 switch (code_obj->kind()) {
459 case Code::BUILTIN:
460 if (marker->IsSmi()) break;
461 // We treat frames for BUILTIN Code objects as OptimizedFrame for now
462 // (all the builtins with JavaScript linkage are actually generated
463 // with TurboFan currently, so this is sound).
464 return OPTIMIZED;
459 case Code::FUNCTION: 465 case Code::FUNCTION:
460 return JAVA_SCRIPT; 466 return JAVA_SCRIPT;
461 case Code::OPTIMIZED_FUNCTION: 467 case Code::OPTIMIZED_FUNCTION:
462 return OPTIMIZED; 468 return OPTIMIZED;
463 case Code::WASM_FUNCTION: 469 case Code::WASM_FUNCTION:
464 return WASM; 470 return WASM;
465 case Code::WASM_TO_JS_FUNCTION: 471 case Code::WASM_TO_JS_FUNCTION:
466 return WASM_TO_JS; 472 return WASM_TO_JS;
467 case Code::JS_TO_WASM_FUNCTION: 473 case Code::JS_TO_WASM_FUNCTION:
468 return JS_TO_WASM; 474 return JS_TO_WASM;
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 PrintF("\npc: %d\n", code_offset_); 980 PrintF("\npc: %d\n", code_offset_);
975 } 981 }
976 982
977 983
978 void OptimizedFrame::Summarize(List<FrameSummary>* frames) { 984 void OptimizedFrame::Summarize(List<FrameSummary>* frames) {
979 DCHECK(frames->length() == 0); 985 DCHECK(frames->length() == 0);
980 DCHECK(is_optimized()); 986 DCHECK(is_optimized());
981 987
982 // Delegate to JS frame in absence of turbofan deoptimization. 988 // Delegate to JS frame in absence of turbofan deoptimization.
983 // TODO(turbofan): Revisit once we support deoptimization across the board. 989 // TODO(turbofan): Revisit once we support deoptimization across the board.
984 if (LookupCode()->is_turbofanned() && function()->shared()->asm_function() && 990 Code* code = LookupCode();
985 !FLAG_turbo_asm_deoptimization) { 991 if (code->kind() == Code::BUILTIN ||
992 (code->is_turbofanned() && function()->shared()->asm_function() &&
993 !FLAG_turbo_asm_deoptimization)) {
986 return JavaScriptFrame::Summarize(frames); 994 return JavaScriptFrame::Summarize(frames);
987 } 995 }
988 996
989 DisallowHeapAllocation no_gc; 997 DisallowHeapAllocation no_gc;
990 int deopt_index = Safepoint::kNoDeoptimizationIndex; 998 int deopt_index = Safepoint::kNoDeoptimizationIndex;
991 DeoptimizationInputData* const data = GetDeoptimizationData(&deopt_index); 999 DeoptimizationInputData* const data = GetDeoptimizationData(&deopt_index);
992 FixedArray* const literal_array = data->LiteralArray(); 1000 FixedArray* const literal_array = data->LiteralArray();
993 1001
994 TranslationIterator it(data->TranslationByteArray(), 1002 TranslationIterator it(data->TranslationByteArray(),
995 data->TranslationIndex(deopt_index)->value()); 1003 data->TranslationIndex(deopt_index)->value());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 it.Skip(Translation::NumberOfOperandsFor(frame_opcode)); 1086 it.Skip(Translation::NumberOfOperandsFor(frame_opcode));
1079 } 1087 }
1080 } 1088 }
1081 DCHECK(!is_constructor); 1089 DCHECK(!is_constructor);
1082 } 1090 }
1083 1091
1084 1092
1085 int OptimizedFrame::LookupExceptionHandlerInTable( 1093 int OptimizedFrame::LookupExceptionHandlerInTable(
1086 int* stack_slots, HandlerTable::CatchPrediction* prediction) { 1094 int* stack_slots, HandlerTable::CatchPrediction* prediction) {
1087 Code* code = LookupCode(); 1095 Code* code = LookupCode();
1088 DCHECK(code->is_optimized_code());
1089 HandlerTable* table = HandlerTable::cast(code->handler_table()); 1096 HandlerTable* table = HandlerTable::cast(code->handler_table());
1090 int pc_offset = static_cast<int>(pc() - code->entry()); 1097 int pc_offset = static_cast<int>(pc() - code->entry());
1091 if (stack_slots) *stack_slots = code->stack_slots(); 1098 if (stack_slots) *stack_slots = code->stack_slots();
1092 return table->LookupReturn(pc_offset, prediction); 1099 return table->LookupReturn(pc_offset, prediction);
1093 } 1100 }
1094 1101
1095 1102
1096 DeoptimizationInputData* OptimizedFrame::GetDeoptimizationData( 1103 DeoptimizationInputData* OptimizedFrame::GetDeoptimizationData(
1097 int* deopt_index) const { 1104 int* deopt_index) const {
1098 DCHECK(is_optimized()); 1105 DCHECK(is_optimized());
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1722 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1716 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1723 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1717 list.Add(frame, zone); 1724 list.Add(frame, zone);
1718 } 1725 }
1719 return list.ToVector(); 1726 return list.ToVector();
1720 } 1727 }
1721 1728
1722 1729
1723 } // namespace internal 1730 } // namespace internal
1724 } // namespace v8 1731 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | src/js/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698