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

Side by Side Diff: src/frames.cc

Issue 1684073002: [Interpreter] Save and restore dispatch table pointer during calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_assm
Patch Set: Address review comments Created 4 years, 10 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/frames.h ('k') | src/ia32/builtins-ia32.cc » ('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 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 } 1135 }
1136 1136
1137 int InterpretedFrame::LookupExceptionHandlerInTable( 1137 int InterpretedFrame::LookupExceptionHandlerInTable(
1138 int* context_register, HandlerTable::CatchPrediction* prediction) { 1138 int* context_register, HandlerTable::CatchPrediction* prediction) {
1139 BytecodeArray* bytecode = function()->shared()->bytecode_array(); 1139 BytecodeArray* bytecode = function()->shared()->bytecode_array();
1140 HandlerTable* table = HandlerTable::cast(bytecode->handler_table()); 1140 HandlerTable* table = HandlerTable::cast(bytecode->handler_table());
1141 int pc_offset = GetBytecodeOffset() + 1; // Point after current bytecode. 1141 int pc_offset = GetBytecodeOffset() + 1; // Point after current bytecode.
1142 return table->LookupRange(pc_offset, context_register, prediction); 1142 return table->LookupRange(pc_offset, context_register, prediction);
1143 } 1143 }
1144 1144
1145
1146 int InterpretedFrame::GetBytecodeOffset() const { 1145 int InterpretedFrame::GetBytecodeOffset() const {
1147 const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex; 1146 const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex;
1148 DCHECK_EQ(InterpreterFrameConstants::kBytecodeOffsetFromFp, 1147 DCHECK_EQ(InterpreterFrameConstants::kBytecodeOffsetFromFp,
1149 StandardFrameConstants::kExpressionsOffset - index * kPointerSize); 1148 StandardFrameConstants::kExpressionsOffset - index * kPointerSize);
1150 int raw_offset = Smi::cast(GetExpression(index))->value(); 1149 int raw_offset = Smi::cast(GetExpression(index))->value();
1151 return raw_offset - BytecodeArray::kHeaderSize + kHeapObjectTag; 1150 return raw_offset - BytecodeArray::kHeaderSize + kHeapObjectTag;
1152 } 1151 }
1153 1152
1154
1155 void InterpretedFrame::PatchBytecodeOffset(int new_offset) { 1153 void InterpretedFrame::PatchBytecodeOffset(int new_offset) {
1156 const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex; 1154 const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex;
1157 DCHECK_EQ(InterpreterFrameConstants::kBytecodeOffsetFromFp, 1155 DCHECK_EQ(InterpreterFrameConstants::kBytecodeOffsetFromFp,
1158 StandardFrameConstants::kExpressionsOffset - index * kPointerSize); 1156 StandardFrameConstants::kExpressionsOffset - index * kPointerSize);
1159 int raw_offset = new_offset + BytecodeArray::kHeaderSize - kHeapObjectTag; 1157 int raw_offset = new_offset + BytecodeArray::kHeaderSize - kHeapObjectTag;
1160 SetExpression(index, Smi::FromInt(raw_offset)); 1158 SetExpression(index, Smi::FromInt(raw_offset));
1161 } 1159 }
1162 1160
1163 Object* InterpretedFrame::GetInterpreterRegister(int register_index) const { 1161 Object* InterpretedFrame::GetInterpreterRegister(int register_index) const {
1164 const int index = InterpreterFrameConstants::kRegisterFileExpressionIndex; 1162 const int index = InterpreterFrameConstants::kRegisterFileExpressionIndex;
1165 DCHECK_EQ(InterpreterFrameConstants::kRegisterFilePointerFromFp, 1163 DCHECK_EQ(InterpreterFrameConstants::kRegisterFilePointerFromFp,
1166 StandardFrameConstants::kExpressionsOffset - index * kPointerSize); 1164 StandardFrameConstants::kExpressionsOffset - index * kPointerSize);
1167 return GetExpression(index + register_index); 1165 return GetExpression(index + register_index);
1168 } 1166 }
1169 1167
1168 Address InterpretedFrame::GetDispatchTable() const {
1169 return Memory::Address_at(
1170 fp() + InterpreterFrameConstants::kDispatchTableFromFp);
1171 }
1172
1173 void InterpretedFrame::PatchDispatchTable(Address dispatch_table) {
1174 Address* dispatch_table_address = reinterpret_cast<Address*>(
1175 fp() + InterpreterFrameConstants::kDispatchTableFromFp);
1176 *dispatch_table_address = dispatch_table;
1177 }
1178
1170 void InterpretedFrame::Summarize(List<FrameSummary>* functions) { 1179 void InterpretedFrame::Summarize(List<FrameSummary>* functions) {
1171 DCHECK(functions->length() == 0); 1180 DCHECK(functions->length() == 0);
1172 AbstractCode* abstract_code = 1181 AbstractCode* abstract_code =
1173 AbstractCode::cast(function()->shared()->bytecode_array()); 1182 AbstractCode::cast(function()->shared()->bytecode_array());
1174 FrameSummary summary(receiver(), function(), abstract_code, 1183 FrameSummary summary(receiver(), function(), abstract_code,
1175 GetBytecodeOffset(), IsConstructor()); 1184 GetBytecodeOffset(), IsConstructor());
1176 functions->Add(summary); 1185 functions->Add(summary);
1177 } 1186 }
1178 1187
1179 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { 1188 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 Object** limit = &Memory::Object_at(fp() + offset) + 1; 1420 Object** limit = &Memory::Object_at(fp() + offset) + 1;
1412 v->VisitPointers(base, limit); 1421 v->VisitPointers(base, limit);
1413 } 1422 }
1414 1423
1415 1424
1416 void JavaScriptFrame::Iterate(ObjectVisitor* v) const { 1425 void JavaScriptFrame::Iterate(ObjectVisitor* v) const {
1417 IterateExpressions(v); 1426 IterateExpressions(v);
1418 IteratePc(v, pc_address(), constant_pool_address(), LookupCode()); 1427 IteratePc(v, pc_address(), constant_pool_address(), LookupCode());
1419 } 1428 }
1420 1429
1430 void InterpretedFrame::Iterate(ObjectVisitor* v) const {
1431 // Visit tagged pointers in the fixed frame.
1432 Object** fixed_frame_base =
1433 &Memory::Object_at(fp() + InterpreterFrameConstants::kNewTargetFromFp);
1434 Object** fixed_frame_limit =
1435 &Memory::Object_at(fp() + StandardFrameConstants::kLastObjectOffset) + 1;
1436 v->VisitPointers(fixed_frame_base, fixed_frame_limit);
1437
1438 // Visit the expressions.
1439 Object** expression_base = &Memory::Object_at(sp());
1440 Object** expression_limit = &Memory::Object_at(
1441 fp() + InterpreterFrameConstants::kBytecodeOffsetFromFp) + 1;
1442 v->VisitPointers(expression_base, expression_limit);
1443
1444 IteratePc(v, pc_address(), constant_pool_address(), LookupCode());
1445 }
1421 1446
1422 void InternalFrame::Iterate(ObjectVisitor* v) const { 1447 void InternalFrame::Iterate(ObjectVisitor* v) const {
1423 // Internal frames only have object pointers on the expression stack 1448 // Internal frames only have object pointers on the expression stack
1424 // as they never have any arguments. 1449 // as they never have any arguments.
1425 IterateExpressions(v); 1450 IterateExpressions(v);
1426 IteratePc(v, pc_address(), constant_pool_address(), LookupCode()); 1451 IteratePc(v, pc_address(), constant_pool_address(), LookupCode());
1427 } 1452 }
1428 1453
1429 1454
1430 void StubFailureTrampolineFrame::Iterate(ObjectVisitor* v) const { 1455 void StubFailureTrampolineFrame::Iterate(ObjectVisitor* v) const {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1663 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1639 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1664 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1640 list.Add(frame, zone); 1665 list.Add(frame, zone);
1641 } 1666 }
1642 return list.ToVector(); 1667 return list.ToVector();
1643 } 1668 }
1644 1669
1645 1670
1646 } // namespace internal 1671 } // namespace internal
1647 } // namespace v8 1672 } // namespace v8
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698