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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 2152853002: [Interpreter] Avoid accessing on-heap literal in VisitLiteral. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: DCHECK to CHECK Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.cc ('k') | test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index ab8868977e54bc8edf37fe78cb38656c2f46924b..2d4a0e8a102a3e12566329d9607cd665325d8ef3 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -549,7 +549,7 @@ BytecodeGenerator::BytecodeGenerator(CompilationInfo* info)
register_allocator_(nullptr),
generator_resume_points_(info->literal()->yield_count(), info->zone()),
generator_state_() {
- InitializeAstVisitor(isolate());
+ InitializeAstVisitor(isolate()->stack_guard()->real_climit());
}
Handle<BytecodeArray> BytecodeGenerator::MakeBytecode() {
@@ -1485,21 +1485,21 @@ void BytecodeGenerator::VisitConditional(Conditional* expr) {
void BytecodeGenerator::VisitLiteral(Literal* expr) {
if (!execution_result()->IsEffect()) {
- Handle<Object> value = expr->value();
- if (value->IsSmi()) {
- builder()->LoadLiteral(Smi::cast(*value));
- } else if (value->IsUndefined(isolate())) {
+ const AstValue* raw_value = expr->raw_value();
+ if (raw_value->IsSmi()) {
+ builder()->LoadLiteral(raw_value->AsSmi());
+ } else if (raw_value->IsUndefined()) {
builder()->LoadUndefined();
- } else if (value->IsTrue(isolate())) {
+ } else if (raw_value->IsTrue()) {
builder()->LoadTrue();
- } else if (value->IsFalse(isolate())) {
+ } else if (raw_value->IsFalse()) {
builder()->LoadFalse();
- } else if (value->IsNull(isolate())) {
+ } else if (raw_value->IsNull()) {
builder()->LoadNull();
- } else if (value->IsTheHole(isolate())) {
+ } else if (raw_value->IsTheHole()) {
builder()->LoadTheHole();
} else {
- builder()->LoadLiteral(value);
+ builder()->LoadLiteral(raw_value->value());
}
execution_result()->SetResultInAccumulator();
}
@@ -2862,6 +2862,8 @@ void BytecodeGenerator::VisitCompareOperation(CompareOperation* expr) {
}
void BytecodeGenerator::VisitArithmeticExpression(BinaryOperation* expr) {
+ // TODO(rmcilroy): Special case "x * 1.0" and "x * -1" which are generated for
+ // +x and -x by the parser.
Register lhs = VisitForRegisterValue(expr->left());
VisitForAccumulatorValue(expr->right());
builder()->BinaryOperation(expr->op(), lhs);
« no previous file with comments | « src/factory.cc ('k') | test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698