[interpreter] Ensure optimizations preserve source positions.

The optimization stages in the bytecode generation pipeline must
preserve source position information. Failure to preserve
source position information could result in single stepping
in the debugger misbehaving or mis-reporting in exception stack traces.

This change adds tests intended to check optimizations do not damage
source position info.

BUG=v8:4280
LOG=N

Review-Url: https://codereview.chromium.org/2042633002
Cr-Commit-Position: refs/heads/master@{#36855}
This commit is contained in:
oth 2016-06-09 05:03:51 -07:00 committed by Commit bot
parent 172ddf4250
commit a9af61d002
11 changed files with 701 additions and 160 deletions

View File

@ -173,6 +173,7 @@ namespace {
void TransformLdaStarToLdrLdar(Bytecode new_bytecode, BytecodeNode* const last, void TransformLdaStarToLdrLdar(Bytecode new_bytecode, BytecodeNode* const last,
BytecodeNode* const current) { BytecodeNode* const current) {
DCHECK_EQ(current->bytecode(), Bytecode::kStar); DCHECK_EQ(current->bytecode(), Bytecode::kStar);
// //
// An example transformation here would be: // An example transformation here would be:
// //
@ -186,20 +187,17 @@ void TransformLdaStarToLdrLdar(Bytecode new_bytecode, BytecodeNode* const last,
last->Transform(new_bytecode, current->operand(0), current->operand_scale()); last->Transform(new_bytecode, current->operand(0), current->operand_scale());
current->set_bytecode(Bytecode::kLdar, current->operand(0), current->set_bytecode(Bytecode::kLdar, current->operand(0),
current->operand_scale()); current->operand_scale());
// If there was a source position on |current| transfer it to the
// updated |last| to maintain the debugger's causal view. ie. if an
// expression position LdrGlobal is the bytecode that could throw
// and if a statement position it needs to be placed before the
// store to R occurs.
last->source_info().Update(current->source_info());
current->source_info().set_invalid();
} }
} // namespace } // namespace
bool BytecodePeepholeOptimizer::ChangeLdaToLdr(BytecodeNode* const current) { bool BytecodePeepholeOptimizer::TransformLastAndCurrentBytecodes(
if (current->bytecode() == Bytecode::kStar) { BytecodeNode* const current) {
if (current->bytecode() == Bytecode::kStar &&
!current->source_info().is_statement()) {
// Note: If the Star is tagged with a statement position, we can't
// perform this transform as the store to the register will
// have the wrong ordering for stepping in the debugger.
switch (last_.bytecode()) { switch (last_.bytecode()) {
case Bytecode::kLdaNamedProperty: case Bytecode::kLdaNamedProperty:
TransformLdaStarToLdrLdar(Bytecode::kLdrNamedProperty, &last_, current); TransformLdaStarToLdrLdar(Bytecode::kLdrNamedProperty, &last_, current);
@ -252,10 +250,10 @@ bool BytecodePeepholeOptimizer::RemoveToBooleanFromLogicalNot(
return can_remove; return can_remove;
} }
bool BytecodePeepholeOptimizer::TransformLastAndCurrentBytecodes( bool BytecodePeepholeOptimizer::TransformCurrentBytecode(
BytecodeNode* const current) { BytecodeNode* const current) {
return RemoveToBooleanFromJump(current) || return RemoveToBooleanFromJump(current) ||
RemoveToBooleanFromLogicalNot(current) || ChangeLdaToLdr(current); RemoveToBooleanFromLogicalNot(current);
} }
bool BytecodePeepholeOptimizer::CanElideLast( bool BytecodePeepholeOptimizer::CanElideLast(
@ -283,7 +281,8 @@ bool BytecodePeepholeOptimizer::CanElideLast(
BytecodeNode* BytecodePeepholeOptimizer::Optimize(BytecodeNode* current) { BytecodeNode* BytecodePeepholeOptimizer::Optimize(BytecodeNode* current) {
TryToRemoveLastExpressionPosition(current); TryToRemoveLastExpressionPosition(current);
if (TransformLastAndCurrentBytecodes(current)) { if (TransformCurrentBytecode(current) ||
TransformLastAndCurrentBytecodes(current)) {
return current; return current;
} }

View File

@ -37,6 +37,7 @@ class BytecodePeepholeOptimizer final : public BytecodePipelineStage,
void Flush(); void Flush();
void TryToRemoveLastExpressionPosition(const BytecodeNode* const current); void TryToRemoveLastExpressionPosition(const BytecodeNode* const current);
bool TransformCurrentBytecode(BytecodeNode* const current);
bool TransformLastAndCurrentBytecodes(BytecodeNode* const current); bool TransformLastAndCurrentBytecodes(BytecodeNode* const current);
bool CanElideCurrent(const BytecodeNode* const current) const; bool CanElideCurrent(const BytecodeNode* const current) const;
bool CanElideLast(const BytecodeNode* const current) const; bool CanElideLast(const BytecodeNode* const current) const;
@ -46,7 +47,6 @@ class BytecodePeepholeOptimizer final : public BytecodePipelineStage,
// Simple substitution methods. // Simple substitution methods.
bool RemoveToBooleanFromJump(BytecodeNode* const current); bool RemoveToBooleanFromJump(BytecodeNode* const current);
bool RemoveToBooleanFromLogicalNot(BytecodeNode* const current); bool RemoveToBooleanFromLogicalNot(BytecodeNode* const current);
bool ChangeLdaToLdr(BytecodeNode* const current);
void InvalidateLast(); void InvalidateLast();
bool LastIsValid() const; bool LastIsValid() const;

View File

@ -107,7 +107,6 @@ Bytecode Bytecodes::FromByte(uint8_t value) {
return bytecode; return bytecode;
} }
// static // static
Bytecode Bytecodes::GetDebugBreak(Bytecode bytecode) { Bytecode Bytecodes::GetDebugBreak(Bytecode bytecode) {
DCHECK(!IsDebugBreak(bytecode)); DCHECK(!IsDebugBreak(bytecode));
@ -140,7 +139,6 @@ int Bytecodes::Size(Bytecode bytecode, OperandScale operand_scale) {
return size; return size;
} }
// static // static
size_t Bytecodes::ReturnCount(Bytecode bytecode) { size_t Bytecodes::ReturnCount(Bytecode bytecode) {
return bytecode == Bytecode::kReturn ? 1 : 0; return bytecode == Bytecode::kReturn ? 1 : 0;
@ -160,7 +158,6 @@ int Bytecodes::NumberOfOperands(Bytecode bytecode) {
return 0; return 0;
} }
// static // static
int Bytecodes::NumberOfRegisterOperands(Bytecode bytecode) { int Bytecodes::NumberOfRegisterOperands(Bytecode bytecode) {
DCHECK(bytecode <= Bytecode::kLast); DCHECK(bytecode <= Bytecode::kLast);
@ -276,6 +273,34 @@ bool Bytecodes::IsAccumulatorLoadWithoutEffects(Bytecode bytecode) {
} }
} }
// static
bool Bytecodes::IsJumpWithoutEffects(Bytecode bytecode) {
return IsJump(bytecode) && !IsJumpIfToBoolean(bytecode);
}
// static
bool Bytecodes::IsRegisterLoadWithoutEffects(Bytecode bytecode) {
switch (bytecode) {
case Bytecode::kMov:
case Bytecode::kPopContext:
case Bytecode::kPushContext:
case Bytecode::kStar:
case Bytecode::kLdrUndefined:
return true;
default:
return false;
}
}
// static
bool Bytecodes::IsWithoutExternalSideEffects(Bytecode bytecode) {
// These bytecodes only manipulate interpreter frame state and will
// never throw.
return (IsAccumulatorLoadWithoutEffects(bytecode) ||
IsRegisterLoadWithoutEffects(bytecode) ||
bytecode == Bytecode::kNop || IsJumpWithoutEffects(bytecode));
}
// static // static
OperandType Bytecodes::GetOperandType(Bytecode bytecode, int i) { OperandType Bytecodes::GetOperandType(Bytecode bytecode, int i) {
DCHECK_LE(bytecode, Bytecode::kLast); DCHECK_LE(bytecode, Bytecode::kLast);
@ -487,15 +512,6 @@ bool Bytecodes::IsPrefixScalingBytecode(Bytecode bytecode) {
} }
} }
// static
bool Bytecodes::IsWithoutExternalSideEffects(Bytecode bytecode) {
// These bytecodes only manipulate interpreter frame state and will
// never throw.
return (IsAccumulatorLoadWithoutEffects(bytecode) || IsLdarOrStar(bytecode) ||
bytecode == Bytecode::kMov || bytecode == Bytecode::kNop ||
IsJump(bytecode));
}
// static // static
bool Bytecodes::IsJumpOrReturn(Bytecode bytecode) { bool Bytecodes::IsJumpOrReturn(Bytecode bytecode) {
return bytecode == Bytecode::kReturn || IsJump(bytecode); return bytecode == Bytecode::kReturn || IsJump(bytecode);

View File

@ -495,10 +495,22 @@ class Bytecodes {
// Return true if |bytecode| writes the accumulator with a boolean value. // Return true if |bytecode| writes the accumulator with a boolean value.
static bool WritesBooleanToAccumulator(Bytecode bytecode); static bool WritesBooleanToAccumulator(Bytecode bytecode);
// Return true if |bytecode| is an accumulator load bytecode, // Return true if |bytecode| is an accumulator load without effects,
// e.g. LdaConstant, LdaTrue, Ldar. // e.g. LdaConstant, LdaTrue, Ldar.
static bool IsAccumulatorLoadWithoutEffects(Bytecode bytecode); static bool IsAccumulatorLoadWithoutEffects(Bytecode bytecode);
// Return true if |bytecode| is a jump without effects,
// e.g. any jump excluding those that include type coercion like
// JumpIfTrueToBoolean.
static bool IsJumpWithoutEffects(Bytecode bytecode);
// Return true if |bytecode| is a register load without effects,
// e.g. Mov, Star, LdrUndefined.
static bool IsRegisterLoadWithoutEffects(Bytecode bytecode);
// Returns true if |bytecode| has no effects.
static bool IsWithoutExternalSideEffects(Bytecode bytecode);
// Returns the i-th operand of |bytecode|. // Returns the i-th operand of |bytecode|.
static OperandType GetOperandType(Bytecode bytecode, int i); static OperandType GetOperandType(Bytecode bytecode, int i);
@ -588,10 +600,6 @@ class Bytecodes {
// Returns true if the bytecode is a scaling prefix bytecode. // Returns true if the bytecode is a scaling prefix bytecode.
static bool IsPrefixScalingBytecode(Bytecode bytecode); static bool IsPrefixScalingBytecode(Bytecode bytecode);
// Returns true if the bytecode has no effects outside the current
// interpreter frame.
static bool IsWithoutExternalSideEffects(Bytecode bytecode);
// Returns true if |operand_type| is any type of register operand. // Returns true if |operand_type| is any type of register operand.
static bool IsRegisterOperandType(OperandType operand_type); static bool IsRegisterOperandType(OperandType operand_type);

View File

@ -72,9 +72,12 @@ executable("cctest") {
"interpreter/bytecode-expectations-printer.cc", "interpreter/bytecode-expectations-printer.cc",
"interpreter/bytecode-expectations-printer.h", "interpreter/bytecode-expectations-printer.h",
"interpreter/interpreter-tester.cc", "interpreter/interpreter-tester.cc",
"interpreter/source-position-matcher.cc",
"interpreter/source-position-matcher.h",
"interpreter/test-bytecode-generator.cc", "interpreter/test-bytecode-generator.cc",
"interpreter/test-interpreter-intrinsics.cc", "interpreter/test-interpreter-intrinsics.cc",
"interpreter/test-interpreter.cc", "interpreter/test-interpreter.cc",
"interpreter/test-source-positions.cc",
"libsampler/test-sampler.cc", "libsampler/test-sampler.cc",
"print-extension.cc", "print-extension.cc",
"profiler-extension.cc", "profiler-extension.cc",

View File

@ -91,9 +91,12 @@
'expression-type-collector.cc', 'expression-type-collector.cc',
'expression-type-collector.h', 'expression-type-collector.h',
'interpreter/interpreter-tester.cc', 'interpreter/interpreter-tester.cc',
'interpreter/source-position-matcher.cc',
'interpreter/source-position-matcher.h',
'interpreter/test-bytecode-generator.cc', 'interpreter/test-bytecode-generator.cc',
'interpreter/test-interpreter.cc', 'interpreter/test-interpreter.cc',
'interpreter/test-interpreter-intrinsics.cc', 'interpreter/test-interpreter-intrinsics.cc',
'interpreter/test-source-positions.cc',
'interpreter/bytecode-expectations-printer.cc', 'interpreter/bytecode-expectations-printer.cc',
'interpreter/bytecode-expectations-printer.h', 'interpreter/bytecode-expectations-printer.h',
'gay-fixed.cc', 'gay-fixed.cc',

View File

@ -790,515 +790,515 @@ bytecodes: [
/* 10 E> */ B(StackCheck), /* 10 E> */ B(StackCheck),
/* 30 S> */ B(Nop), /* 30 S> */ B(Nop),
/* 35 E> */ B(Ldar), R(arg1), /* 35 E> */ B(Ldar), R(arg1),
/* 32 E> */ B(LdrKeyedProperty), R(arg0), U8(1), R(0), B(LdrKeyedProperty), R(arg0), U8(1), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 42 S> */ B(Nop), /* 42 S> */ B(Nop),
/* 47 E> */ B(Ldar), R(arg1), /* 47 E> */ B(Ldar), R(arg1),
/* 44 E> */ B(LdrKeyedProperty), R(arg0), U8(3), R(0), B(LdrKeyedProperty), R(arg0), U8(3), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 54 S> */ B(Nop), /* 54 S> */ B(Nop),
/* 59 E> */ B(Ldar), R(arg1), /* 59 E> */ B(Ldar), R(arg1),
/* 56 E> */ B(LdrKeyedProperty), R(arg0), U8(5), R(0), B(LdrKeyedProperty), R(arg0), U8(5), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 66 S> */ B(Nop), /* 66 S> */ B(Nop),
/* 71 E> */ B(Ldar), R(arg1), /* 71 E> */ B(Ldar), R(arg1),
/* 68 E> */ B(LdrKeyedProperty), R(arg0), U8(7), R(0), B(LdrKeyedProperty), R(arg0), U8(7), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 78 S> */ B(Nop), /* 78 S> */ B(Nop),
/* 83 E> */ B(Ldar), R(arg1), /* 83 E> */ B(Ldar), R(arg1),
/* 80 E> */ B(LdrKeyedProperty), R(arg0), U8(9), R(0), B(LdrKeyedProperty), R(arg0), U8(9), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 90 S> */ B(Nop), /* 90 S> */ B(Nop),
/* 95 E> */ B(Ldar), R(arg1), /* 95 E> */ B(Ldar), R(arg1),
/* 92 E> */ B(LdrKeyedProperty), R(arg0), U8(11), R(0), B(LdrKeyedProperty), R(arg0), U8(11), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 102 S> */ B(Nop), /* 102 S> */ B(Nop),
/* 107 E> */ B(Ldar), R(arg1), /* 107 E> */ B(Ldar), R(arg1),
/* 104 E> */ B(LdrKeyedProperty), R(arg0), U8(13), R(0), B(LdrKeyedProperty), R(arg0), U8(13), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 114 S> */ B(Nop), /* 114 S> */ B(Nop),
/* 119 E> */ B(Ldar), R(arg1), /* 119 E> */ B(Ldar), R(arg1),
/* 116 E> */ B(LdrKeyedProperty), R(arg0), U8(15), R(0), B(LdrKeyedProperty), R(arg0), U8(15), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 126 S> */ B(Nop), /* 126 S> */ B(Nop),
/* 131 E> */ B(Ldar), R(arg1), /* 131 E> */ B(Ldar), R(arg1),
/* 128 E> */ B(LdrKeyedProperty), R(arg0), U8(17), R(0), B(LdrKeyedProperty), R(arg0), U8(17), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 138 S> */ B(Nop), /* 138 S> */ B(Nop),
/* 143 E> */ B(Ldar), R(arg1), /* 143 E> */ B(Ldar), R(arg1),
/* 140 E> */ B(LdrKeyedProperty), R(arg0), U8(19), R(0), B(LdrKeyedProperty), R(arg0), U8(19), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 150 S> */ B(Nop), /* 150 S> */ B(Nop),
/* 155 E> */ B(Ldar), R(arg1), /* 155 E> */ B(Ldar), R(arg1),
/* 152 E> */ B(LdrKeyedProperty), R(arg0), U8(21), R(0), B(LdrKeyedProperty), R(arg0), U8(21), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 162 S> */ B(Nop), /* 162 S> */ B(Nop),
/* 167 E> */ B(Ldar), R(arg1), /* 167 E> */ B(Ldar), R(arg1),
/* 164 E> */ B(LdrKeyedProperty), R(arg0), U8(23), R(0), B(LdrKeyedProperty), R(arg0), U8(23), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 174 S> */ B(Nop), /* 174 S> */ B(Nop),
/* 179 E> */ B(Ldar), R(arg1), /* 179 E> */ B(Ldar), R(arg1),
/* 176 E> */ B(LdrKeyedProperty), R(arg0), U8(25), R(0), B(LdrKeyedProperty), R(arg0), U8(25), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 186 S> */ B(Nop), /* 186 S> */ B(Nop),
/* 191 E> */ B(Ldar), R(arg1), /* 191 E> */ B(Ldar), R(arg1),
/* 188 E> */ B(LdrKeyedProperty), R(arg0), U8(27), R(0), B(LdrKeyedProperty), R(arg0), U8(27), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 198 S> */ B(Nop), /* 198 S> */ B(Nop),
/* 203 E> */ B(Ldar), R(arg1), /* 203 E> */ B(Ldar), R(arg1),
/* 200 E> */ B(LdrKeyedProperty), R(arg0), U8(29), R(0), B(LdrKeyedProperty), R(arg0), U8(29), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 210 S> */ B(Nop), /* 210 S> */ B(Nop),
/* 215 E> */ B(Ldar), R(arg1), /* 215 E> */ B(Ldar), R(arg1),
/* 212 E> */ B(LdrKeyedProperty), R(arg0), U8(31), R(0), B(LdrKeyedProperty), R(arg0), U8(31), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 222 S> */ B(Nop), /* 222 S> */ B(Nop),
/* 227 E> */ B(Ldar), R(arg1), /* 227 E> */ B(Ldar), R(arg1),
/* 224 E> */ B(LdrKeyedProperty), R(arg0), U8(33), R(0), B(LdrKeyedProperty), R(arg0), U8(33), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 234 S> */ B(Nop), /* 234 S> */ B(Nop),
/* 239 E> */ B(Ldar), R(arg1), /* 239 E> */ B(Ldar), R(arg1),
/* 236 E> */ B(LdrKeyedProperty), R(arg0), U8(35), R(0), B(LdrKeyedProperty), R(arg0), U8(35), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 246 S> */ B(Nop), /* 246 S> */ B(Nop),
/* 251 E> */ B(Ldar), R(arg1), /* 251 E> */ B(Ldar), R(arg1),
/* 248 E> */ B(LdrKeyedProperty), R(arg0), U8(37), R(0), B(LdrKeyedProperty), R(arg0), U8(37), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 258 S> */ B(Nop), /* 258 S> */ B(Nop),
/* 263 E> */ B(Ldar), R(arg1), /* 263 E> */ B(Ldar), R(arg1),
/* 260 E> */ B(LdrKeyedProperty), R(arg0), U8(39), R(0), B(LdrKeyedProperty), R(arg0), U8(39), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 270 S> */ B(Nop), /* 270 S> */ B(Nop),
/* 275 E> */ B(Ldar), R(arg1), /* 275 E> */ B(Ldar), R(arg1),
/* 272 E> */ B(LdrKeyedProperty), R(arg0), U8(41), R(0), B(LdrKeyedProperty), R(arg0), U8(41), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 282 S> */ B(Nop), /* 282 S> */ B(Nop),
/* 287 E> */ B(Ldar), R(arg1), /* 287 E> */ B(Ldar), R(arg1),
/* 284 E> */ B(LdrKeyedProperty), R(arg0), U8(43), R(0), B(LdrKeyedProperty), R(arg0), U8(43), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 294 S> */ B(Nop), /* 294 S> */ B(Nop),
/* 299 E> */ B(Ldar), R(arg1), /* 299 E> */ B(Ldar), R(arg1),
/* 296 E> */ B(LdrKeyedProperty), R(arg0), U8(45), R(0), B(LdrKeyedProperty), R(arg0), U8(45), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 306 S> */ B(Nop), /* 306 S> */ B(Nop),
/* 311 E> */ B(Ldar), R(arg1), /* 311 E> */ B(Ldar), R(arg1),
/* 308 E> */ B(LdrKeyedProperty), R(arg0), U8(47), R(0), B(LdrKeyedProperty), R(arg0), U8(47), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 318 S> */ B(Nop), /* 318 S> */ B(Nop),
/* 323 E> */ B(Ldar), R(arg1), /* 323 E> */ B(Ldar), R(arg1),
/* 320 E> */ B(LdrKeyedProperty), R(arg0), U8(49), R(0), B(LdrKeyedProperty), R(arg0), U8(49), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 330 S> */ B(Nop), /* 330 S> */ B(Nop),
/* 335 E> */ B(Ldar), R(arg1), /* 335 E> */ B(Ldar), R(arg1),
/* 332 E> */ B(LdrKeyedProperty), R(arg0), U8(51), R(0), B(LdrKeyedProperty), R(arg0), U8(51), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 342 S> */ B(Nop), /* 342 S> */ B(Nop),
/* 347 E> */ B(Ldar), R(arg1), /* 347 E> */ B(Ldar), R(arg1),
/* 344 E> */ B(LdrKeyedProperty), R(arg0), U8(53), R(0), B(LdrKeyedProperty), R(arg0), U8(53), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 354 S> */ B(Nop), /* 354 S> */ B(Nop),
/* 359 E> */ B(Ldar), R(arg1), /* 359 E> */ B(Ldar), R(arg1),
/* 356 E> */ B(LdrKeyedProperty), R(arg0), U8(55), R(0), B(LdrKeyedProperty), R(arg0), U8(55), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 366 S> */ B(Nop), /* 366 S> */ B(Nop),
/* 371 E> */ B(Ldar), R(arg1), /* 371 E> */ B(Ldar), R(arg1),
/* 368 E> */ B(LdrKeyedProperty), R(arg0), U8(57), R(0), B(LdrKeyedProperty), R(arg0), U8(57), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 378 S> */ B(Nop), /* 378 S> */ B(Nop),
/* 383 E> */ B(Ldar), R(arg1), /* 383 E> */ B(Ldar), R(arg1),
/* 380 E> */ B(LdrKeyedProperty), R(arg0), U8(59), R(0), B(LdrKeyedProperty), R(arg0), U8(59), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 390 S> */ B(Nop), /* 390 S> */ B(Nop),
/* 395 E> */ B(Ldar), R(arg1), /* 395 E> */ B(Ldar), R(arg1),
/* 392 E> */ B(LdrKeyedProperty), R(arg0), U8(61), R(0), B(LdrKeyedProperty), R(arg0), U8(61), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 402 S> */ B(Nop), /* 402 S> */ B(Nop),
/* 407 E> */ B(Ldar), R(arg1), /* 407 E> */ B(Ldar), R(arg1),
/* 404 E> */ B(LdrKeyedProperty), R(arg0), U8(63), R(0), B(LdrKeyedProperty), R(arg0), U8(63), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 414 S> */ B(Nop), /* 414 S> */ B(Nop),
/* 419 E> */ B(Ldar), R(arg1), /* 419 E> */ B(Ldar), R(arg1),
/* 416 E> */ B(LdrKeyedProperty), R(arg0), U8(65), R(0), B(LdrKeyedProperty), R(arg0), U8(65), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 426 S> */ B(Nop), /* 426 S> */ B(Nop),
/* 431 E> */ B(Ldar), R(arg1), /* 431 E> */ B(Ldar), R(arg1),
/* 428 E> */ B(LdrKeyedProperty), R(arg0), U8(67), R(0), B(LdrKeyedProperty), R(arg0), U8(67), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 438 S> */ B(Nop), /* 438 S> */ B(Nop),
/* 443 E> */ B(Ldar), R(arg1), /* 443 E> */ B(Ldar), R(arg1),
/* 440 E> */ B(LdrKeyedProperty), R(arg0), U8(69), R(0), B(LdrKeyedProperty), R(arg0), U8(69), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 450 S> */ B(Nop), /* 450 S> */ B(Nop),
/* 455 E> */ B(Ldar), R(arg1), /* 455 E> */ B(Ldar), R(arg1),
/* 452 E> */ B(LdrKeyedProperty), R(arg0), U8(71), R(0), B(LdrKeyedProperty), R(arg0), U8(71), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 462 S> */ B(Nop), /* 462 S> */ B(Nop),
/* 467 E> */ B(Ldar), R(arg1), /* 467 E> */ B(Ldar), R(arg1),
/* 464 E> */ B(LdrKeyedProperty), R(arg0), U8(73), R(0), B(LdrKeyedProperty), R(arg0), U8(73), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 474 S> */ B(Nop), /* 474 S> */ B(Nop),
/* 479 E> */ B(Ldar), R(arg1), /* 479 E> */ B(Ldar), R(arg1),
/* 476 E> */ B(LdrKeyedProperty), R(arg0), U8(75), R(0), B(LdrKeyedProperty), R(arg0), U8(75), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 486 S> */ B(Nop), /* 486 S> */ B(Nop),
/* 491 E> */ B(Ldar), R(arg1), /* 491 E> */ B(Ldar), R(arg1),
/* 488 E> */ B(LdrKeyedProperty), R(arg0), U8(77), R(0), B(LdrKeyedProperty), R(arg0), U8(77), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 498 S> */ B(Nop), /* 498 S> */ B(Nop),
/* 503 E> */ B(Ldar), R(arg1), /* 503 E> */ B(Ldar), R(arg1),
/* 500 E> */ B(LdrKeyedProperty), R(arg0), U8(79), R(0), B(LdrKeyedProperty), R(arg0), U8(79), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 510 S> */ B(Nop), /* 510 S> */ B(Nop),
/* 515 E> */ B(Ldar), R(arg1), /* 515 E> */ B(Ldar), R(arg1),
/* 512 E> */ B(LdrKeyedProperty), R(arg0), U8(81), R(0), B(LdrKeyedProperty), R(arg0), U8(81), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 522 S> */ B(Nop), /* 522 S> */ B(Nop),
/* 527 E> */ B(Ldar), R(arg1), /* 527 E> */ B(Ldar), R(arg1),
/* 524 E> */ B(LdrKeyedProperty), R(arg0), U8(83), R(0), B(LdrKeyedProperty), R(arg0), U8(83), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 534 S> */ B(Nop), /* 534 S> */ B(Nop),
/* 539 E> */ B(Ldar), R(arg1), /* 539 E> */ B(Ldar), R(arg1),
/* 536 E> */ B(LdrKeyedProperty), R(arg0), U8(85), R(0), B(LdrKeyedProperty), R(arg0), U8(85), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 546 S> */ B(Nop), /* 546 S> */ B(Nop),
/* 551 E> */ B(Ldar), R(arg1), /* 551 E> */ B(Ldar), R(arg1),
/* 548 E> */ B(LdrKeyedProperty), R(arg0), U8(87), R(0), B(LdrKeyedProperty), R(arg0), U8(87), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 558 S> */ B(Nop), /* 558 S> */ B(Nop),
/* 563 E> */ B(Ldar), R(arg1), /* 563 E> */ B(Ldar), R(arg1),
/* 560 E> */ B(LdrKeyedProperty), R(arg0), U8(89), R(0), B(LdrKeyedProperty), R(arg0), U8(89), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 570 S> */ B(Nop), /* 570 S> */ B(Nop),
/* 575 E> */ B(Ldar), R(arg1), /* 575 E> */ B(Ldar), R(arg1),
/* 572 E> */ B(LdrKeyedProperty), R(arg0), U8(91), R(0), B(LdrKeyedProperty), R(arg0), U8(91), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 582 S> */ B(Nop), /* 582 S> */ B(Nop),
/* 587 E> */ B(Ldar), R(arg1), /* 587 E> */ B(Ldar), R(arg1),
/* 584 E> */ B(LdrKeyedProperty), R(arg0), U8(93), R(0), B(LdrKeyedProperty), R(arg0), U8(93), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 594 S> */ B(Nop), /* 594 S> */ B(Nop),
/* 599 E> */ B(Ldar), R(arg1), /* 599 E> */ B(Ldar), R(arg1),
/* 596 E> */ B(LdrKeyedProperty), R(arg0), U8(95), R(0), B(LdrKeyedProperty), R(arg0), U8(95), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 606 S> */ B(Nop), /* 606 S> */ B(Nop),
/* 611 E> */ B(Ldar), R(arg1), /* 611 E> */ B(Ldar), R(arg1),
/* 608 E> */ B(LdrKeyedProperty), R(arg0), U8(97), R(0), B(LdrKeyedProperty), R(arg0), U8(97), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 618 S> */ B(Nop), /* 618 S> */ B(Nop),
/* 623 E> */ B(Ldar), R(arg1), /* 623 E> */ B(Ldar), R(arg1),
/* 620 E> */ B(LdrKeyedProperty), R(arg0), U8(99), R(0), B(LdrKeyedProperty), R(arg0), U8(99), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 630 S> */ B(Nop), /* 630 S> */ B(Nop),
/* 635 E> */ B(Ldar), R(arg1), /* 635 E> */ B(Ldar), R(arg1),
/* 632 E> */ B(LdrKeyedProperty), R(arg0), U8(101), R(0), B(LdrKeyedProperty), R(arg0), U8(101), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 642 S> */ B(Nop), /* 642 S> */ B(Nop),
/* 647 E> */ B(Ldar), R(arg1), /* 647 E> */ B(Ldar), R(arg1),
/* 644 E> */ B(LdrKeyedProperty), R(arg0), U8(103), R(0), B(LdrKeyedProperty), R(arg0), U8(103), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 654 S> */ B(Nop), /* 654 S> */ B(Nop),
/* 659 E> */ B(Ldar), R(arg1), /* 659 E> */ B(Ldar), R(arg1),
/* 656 E> */ B(LdrKeyedProperty), R(arg0), U8(105), R(0), B(LdrKeyedProperty), R(arg0), U8(105), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 666 S> */ B(Nop), /* 666 S> */ B(Nop),
/* 671 E> */ B(Ldar), R(arg1), /* 671 E> */ B(Ldar), R(arg1),
/* 668 E> */ B(LdrKeyedProperty), R(arg0), U8(107), R(0), B(LdrKeyedProperty), R(arg0), U8(107), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 678 S> */ B(Nop), /* 678 S> */ B(Nop),
/* 683 E> */ B(Ldar), R(arg1), /* 683 E> */ B(Ldar), R(arg1),
/* 680 E> */ B(LdrKeyedProperty), R(arg0), U8(109), R(0), B(LdrKeyedProperty), R(arg0), U8(109), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 690 S> */ B(Nop), /* 690 S> */ B(Nop),
/* 695 E> */ B(Ldar), R(arg1), /* 695 E> */ B(Ldar), R(arg1),
/* 692 E> */ B(LdrKeyedProperty), R(arg0), U8(111), R(0), B(LdrKeyedProperty), R(arg0), U8(111), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 702 S> */ B(Nop), /* 702 S> */ B(Nop),
/* 707 E> */ B(Ldar), R(arg1), /* 707 E> */ B(Ldar), R(arg1),
/* 704 E> */ B(LdrKeyedProperty), R(arg0), U8(113), R(0), B(LdrKeyedProperty), R(arg0), U8(113), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 714 S> */ B(Nop), /* 714 S> */ B(Nop),
/* 719 E> */ B(Ldar), R(arg1), /* 719 E> */ B(Ldar), R(arg1),
/* 716 E> */ B(LdrKeyedProperty), R(arg0), U8(115), R(0), B(LdrKeyedProperty), R(arg0), U8(115), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 726 S> */ B(Nop), /* 726 S> */ B(Nop),
/* 731 E> */ B(Ldar), R(arg1), /* 731 E> */ B(Ldar), R(arg1),
/* 728 E> */ B(LdrKeyedProperty), R(arg0), U8(117), R(0), B(LdrKeyedProperty), R(arg0), U8(117), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 738 S> */ B(Nop), /* 738 S> */ B(Nop),
/* 743 E> */ B(Ldar), R(arg1), /* 743 E> */ B(Ldar), R(arg1),
/* 740 E> */ B(LdrKeyedProperty), R(arg0), U8(119), R(0), B(LdrKeyedProperty), R(arg0), U8(119), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 750 S> */ B(Nop), /* 750 S> */ B(Nop),
/* 755 E> */ B(Ldar), R(arg1), /* 755 E> */ B(Ldar), R(arg1),
/* 752 E> */ B(LdrKeyedProperty), R(arg0), U8(121), R(0), B(LdrKeyedProperty), R(arg0), U8(121), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 762 S> */ B(Nop), /* 762 S> */ B(Nop),
/* 767 E> */ B(Ldar), R(arg1), /* 767 E> */ B(Ldar), R(arg1),
/* 764 E> */ B(LdrKeyedProperty), R(arg0), U8(123), R(0), B(LdrKeyedProperty), R(arg0), U8(123), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 774 S> */ B(Nop), /* 774 S> */ B(Nop),
/* 779 E> */ B(Ldar), R(arg1), /* 779 E> */ B(Ldar), R(arg1),
/* 776 E> */ B(LdrKeyedProperty), R(arg0), U8(125), R(0), B(LdrKeyedProperty), R(arg0), U8(125), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 786 S> */ B(Nop), /* 786 S> */ B(Nop),
/* 791 E> */ B(Ldar), R(arg1), /* 791 E> */ B(Ldar), R(arg1),
/* 788 E> */ B(LdrKeyedProperty), R(arg0), U8(127), R(0), B(LdrKeyedProperty), R(arg0), U8(127), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 798 S> */ B(Nop), /* 798 S> */ B(Nop),
/* 803 E> */ B(Ldar), R(arg1), /* 803 E> */ B(Ldar), R(arg1),
/* 800 E> */ B(LdrKeyedProperty), R(arg0), U8(129), R(0), B(LdrKeyedProperty), R(arg0), U8(129), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 810 S> */ B(Nop), /* 810 S> */ B(Nop),
/* 815 E> */ B(Ldar), R(arg1), /* 815 E> */ B(Ldar), R(arg1),
/* 812 E> */ B(LdrKeyedProperty), R(arg0), U8(131), R(0), B(LdrKeyedProperty), R(arg0), U8(131), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 822 S> */ B(Nop), /* 822 S> */ B(Nop),
/* 827 E> */ B(Ldar), R(arg1), /* 827 E> */ B(Ldar), R(arg1),
/* 824 E> */ B(LdrKeyedProperty), R(arg0), U8(133), R(0), B(LdrKeyedProperty), R(arg0), U8(133), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 834 S> */ B(Nop), /* 834 S> */ B(Nop),
/* 839 E> */ B(Ldar), R(arg1), /* 839 E> */ B(Ldar), R(arg1),
/* 836 E> */ B(LdrKeyedProperty), R(arg0), U8(135), R(0), B(LdrKeyedProperty), R(arg0), U8(135), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 846 S> */ B(Nop), /* 846 S> */ B(Nop),
/* 851 E> */ B(Ldar), R(arg1), /* 851 E> */ B(Ldar), R(arg1),
/* 848 E> */ B(LdrKeyedProperty), R(arg0), U8(137), R(0), B(LdrKeyedProperty), R(arg0), U8(137), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 858 S> */ B(Nop), /* 858 S> */ B(Nop),
/* 863 E> */ B(Ldar), R(arg1), /* 863 E> */ B(Ldar), R(arg1),
/* 860 E> */ B(LdrKeyedProperty), R(arg0), U8(139), R(0), B(LdrKeyedProperty), R(arg0), U8(139), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 870 S> */ B(Nop), /* 870 S> */ B(Nop),
/* 875 E> */ B(Ldar), R(arg1), /* 875 E> */ B(Ldar), R(arg1),
/* 872 E> */ B(LdrKeyedProperty), R(arg0), U8(141), R(0), B(LdrKeyedProperty), R(arg0), U8(141), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 882 S> */ B(Nop), /* 882 S> */ B(Nop),
/* 887 E> */ B(Ldar), R(arg1), /* 887 E> */ B(Ldar), R(arg1),
/* 884 E> */ B(LdrKeyedProperty), R(arg0), U8(143), R(0), B(LdrKeyedProperty), R(arg0), U8(143), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 894 S> */ B(Nop), /* 894 S> */ B(Nop),
/* 899 E> */ B(Ldar), R(arg1), /* 899 E> */ B(Ldar), R(arg1),
/* 896 E> */ B(LdrKeyedProperty), R(arg0), U8(145), R(0), B(LdrKeyedProperty), R(arg0), U8(145), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 906 S> */ B(Nop), /* 906 S> */ B(Nop),
/* 911 E> */ B(Ldar), R(arg1), /* 911 E> */ B(Ldar), R(arg1),
/* 908 E> */ B(LdrKeyedProperty), R(arg0), U8(147), R(0), B(LdrKeyedProperty), R(arg0), U8(147), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 918 S> */ B(Nop), /* 918 S> */ B(Nop),
/* 923 E> */ B(Ldar), R(arg1), /* 923 E> */ B(Ldar), R(arg1),
/* 920 E> */ B(LdrKeyedProperty), R(arg0), U8(149), R(0), B(LdrKeyedProperty), R(arg0), U8(149), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 930 S> */ B(Nop), /* 930 S> */ B(Nop),
/* 935 E> */ B(Ldar), R(arg1), /* 935 E> */ B(Ldar), R(arg1),
/* 932 E> */ B(LdrKeyedProperty), R(arg0), U8(151), R(0), B(LdrKeyedProperty), R(arg0), U8(151), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 942 S> */ B(Nop), /* 942 S> */ B(Nop),
/* 947 E> */ B(Ldar), R(arg1), /* 947 E> */ B(Ldar), R(arg1),
/* 944 E> */ B(LdrKeyedProperty), R(arg0), U8(153), R(0), B(LdrKeyedProperty), R(arg0), U8(153), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 954 S> */ B(Nop), /* 954 S> */ B(Nop),
/* 959 E> */ B(Ldar), R(arg1), /* 959 E> */ B(Ldar), R(arg1),
/* 956 E> */ B(LdrKeyedProperty), R(arg0), U8(155), R(0), B(LdrKeyedProperty), R(arg0), U8(155), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 966 S> */ B(Nop), /* 966 S> */ B(Nop),
/* 971 E> */ B(Ldar), R(arg1), /* 971 E> */ B(Ldar), R(arg1),
/* 968 E> */ B(LdrKeyedProperty), R(arg0), U8(157), R(0), B(LdrKeyedProperty), R(arg0), U8(157), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 978 S> */ B(Nop), /* 978 S> */ B(Nop),
/* 983 E> */ B(Ldar), R(arg1), /* 983 E> */ B(Ldar), R(arg1),
/* 980 E> */ B(LdrKeyedProperty), R(arg0), U8(159), R(0), B(LdrKeyedProperty), R(arg0), U8(159), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 990 S> */ B(Nop), /* 990 S> */ B(Nop),
/* 995 E> */ B(Ldar), R(arg1), /* 995 E> */ B(Ldar), R(arg1),
/* 992 E> */ B(LdrKeyedProperty), R(arg0), U8(161), R(0), B(LdrKeyedProperty), R(arg0), U8(161), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1002 S> */ B(Nop), /* 1002 S> */ B(Nop),
/* 1007 E> */ B(Ldar), R(arg1), /* 1007 E> */ B(Ldar), R(arg1),
/* 1004 E> */ B(LdrKeyedProperty), R(arg0), U8(163), R(0), B(LdrKeyedProperty), R(arg0), U8(163), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1014 S> */ B(Nop), /* 1014 S> */ B(Nop),
/* 1019 E> */ B(Ldar), R(arg1), /* 1019 E> */ B(Ldar), R(arg1),
/* 1016 E> */ B(LdrKeyedProperty), R(arg0), U8(165), R(0), B(LdrKeyedProperty), R(arg0), U8(165), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1026 S> */ B(Nop), /* 1026 S> */ B(Nop),
/* 1031 E> */ B(Ldar), R(arg1), /* 1031 E> */ B(Ldar), R(arg1),
/* 1028 E> */ B(LdrKeyedProperty), R(arg0), U8(167), R(0), B(LdrKeyedProperty), R(arg0), U8(167), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1038 S> */ B(Nop), /* 1038 S> */ B(Nop),
/* 1043 E> */ B(Ldar), R(arg1), /* 1043 E> */ B(Ldar), R(arg1),
/* 1040 E> */ B(LdrKeyedProperty), R(arg0), U8(169), R(0), B(LdrKeyedProperty), R(arg0), U8(169), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1050 S> */ B(Nop), /* 1050 S> */ B(Nop),
/* 1055 E> */ B(Ldar), R(arg1), /* 1055 E> */ B(Ldar), R(arg1),
/* 1052 E> */ B(LdrKeyedProperty), R(arg0), U8(171), R(0), B(LdrKeyedProperty), R(arg0), U8(171), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1062 S> */ B(Nop), /* 1062 S> */ B(Nop),
/* 1067 E> */ B(Ldar), R(arg1), /* 1067 E> */ B(Ldar), R(arg1),
/* 1064 E> */ B(LdrKeyedProperty), R(arg0), U8(173), R(0), B(LdrKeyedProperty), R(arg0), U8(173), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1074 S> */ B(Nop), /* 1074 S> */ B(Nop),
/* 1079 E> */ B(Ldar), R(arg1), /* 1079 E> */ B(Ldar), R(arg1),
/* 1076 E> */ B(LdrKeyedProperty), R(arg0), U8(175), R(0), B(LdrKeyedProperty), R(arg0), U8(175), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1086 S> */ B(Nop), /* 1086 S> */ B(Nop),
/* 1091 E> */ B(Ldar), R(arg1), /* 1091 E> */ B(Ldar), R(arg1),
/* 1088 E> */ B(LdrKeyedProperty), R(arg0), U8(177), R(0), B(LdrKeyedProperty), R(arg0), U8(177), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1098 S> */ B(Nop), /* 1098 S> */ B(Nop),
/* 1103 E> */ B(Ldar), R(arg1), /* 1103 E> */ B(Ldar), R(arg1),
/* 1100 E> */ B(LdrKeyedProperty), R(arg0), U8(179), R(0), B(LdrKeyedProperty), R(arg0), U8(179), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1110 S> */ B(Nop), /* 1110 S> */ B(Nop),
/* 1115 E> */ B(Ldar), R(arg1), /* 1115 E> */ B(Ldar), R(arg1),
/* 1112 E> */ B(LdrKeyedProperty), R(arg0), U8(181), R(0), B(LdrKeyedProperty), R(arg0), U8(181), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1122 S> */ B(Nop), /* 1122 S> */ B(Nop),
/* 1127 E> */ B(Ldar), R(arg1), /* 1127 E> */ B(Ldar), R(arg1),
/* 1124 E> */ B(LdrKeyedProperty), R(arg0), U8(183), R(0), B(LdrKeyedProperty), R(arg0), U8(183), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1134 S> */ B(Nop), /* 1134 S> */ B(Nop),
/* 1139 E> */ B(Ldar), R(arg1), /* 1139 E> */ B(Ldar), R(arg1),
/* 1136 E> */ B(LdrKeyedProperty), R(arg0), U8(185), R(0), B(LdrKeyedProperty), R(arg0), U8(185), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1146 S> */ B(Nop), /* 1146 S> */ B(Nop),
/* 1151 E> */ B(Ldar), R(arg1), /* 1151 E> */ B(Ldar), R(arg1),
/* 1148 E> */ B(LdrKeyedProperty), R(arg0), U8(187), R(0), B(LdrKeyedProperty), R(arg0), U8(187), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1158 S> */ B(Nop), /* 1158 S> */ B(Nop),
/* 1163 E> */ B(Ldar), R(arg1), /* 1163 E> */ B(Ldar), R(arg1),
/* 1160 E> */ B(LdrKeyedProperty), R(arg0), U8(189), R(0), B(LdrKeyedProperty), R(arg0), U8(189), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1170 S> */ B(Nop), /* 1170 S> */ B(Nop),
/* 1175 E> */ B(Ldar), R(arg1), /* 1175 E> */ B(Ldar), R(arg1),
/* 1172 E> */ B(LdrKeyedProperty), R(arg0), U8(191), R(0), B(LdrKeyedProperty), R(arg0), U8(191), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1182 S> */ B(Nop), /* 1182 S> */ B(Nop),
/* 1187 E> */ B(Ldar), R(arg1), /* 1187 E> */ B(Ldar), R(arg1),
/* 1184 E> */ B(LdrKeyedProperty), R(arg0), U8(193), R(0), B(LdrKeyedProperty), R(arg0), U8(193), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1194 S> */ B(Nop), /* 1194 S> */ B(Nop),
/* 1199 E> */ B(Ldar), R(arg1), /* 1199 E> */ B(Ldar), R(arg1),
/* 1196 E> */ B(LdrKeyedProperty), R(arg0), U8(195), R(0), B(LdrKeyedProperty), R(arg0), U8(195), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1206 S> */ B(Nop), /* 1206 S> */ B(Nop),
/* 1211 E> */ B(Ldar), R(arg1), /* 1211 E> */ B(Ldar), R(arg1),
/* 1208 E> */ B(LdrKeyedProperty), R(arg0), U8(197), R(0), B(LdrKeyedProperty), R(arg0), U8(197), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1218 S> */ B(Nop), /* 1218 S> */ B(Nop),
/* 1223 E> */ B(Ldar), R(arg1), /* 1223 E> */ B(Ldar), R(arg1),
/* 1220 E> */ B(LdrKeyedProperty), R(arg0), U8(199), R(0), B(LdrKeyedProperty), R(arg0), U8(199), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1230 S> */ B(Nop), /* 1230 S> */ B(Nop),
/* 1235 E> */ B(Ldar), R(arg1), /* 1235 E> */ B(Ldar), R(arg1),
/* 1232 E> */ B(LdrKeyedProperty), R(arg0), U8(201), R(0), B(LdrKeyedProperty), R(arg0), U8(201), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1242 S> */ B(Nop), /* 1242 S> */ B(Nop),
/* 1247 E> */ B(Ldar), R(arg1), /* 1247 E> */ B(Ldar), R(arg1),
/* 1244 E> */ B(LdrKeyedProperty), R(arg0), U8(203), R(0), B(LdrKeyedProperty), R(arg0), U8(203), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1254 S> */ B(Nop), /* 1254 S> */ B(Nop),
/* 1259 E> */ B(Ldar), R(arg1), /* 1259 E> */ B(Ldar), R(arg1),
/* 1256 E> */ B(LdrKeyedProperty), R(arg0), U8(205), R(0), B(LdrKeyedProperty), R(arg0), U8(205), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1266 S> */ B(Nop), /* 1266 S> */ B(Nop),
/* 1271 E> */ B(Ldar), R(arg1), /* 1271 E> */ B(Ldar), R(arg1),
/* 1268 E> */ B(LdrKeyedProperty), R(arg0), U8(207), R(0), B(LdrKeyedProperty), R(arg0), U8(207), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1278 S> */ B(Nop), /* 1278 S> */ B(Nop),
/* 1283 E> */ B(Ldar), R(arg1), /* 1283 E> */ B(Ldar), R(arg1),
/* 1280 E> */ B(LdrKeyedProperty), R(arg0), U8(209), R(0), B(LdrKeyedProperty), R(arg0), U8(209), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1290 S> */ B(Nop), /* 1290 S> */ B(Nop),
/* 1295 E> */ B(Ldar), R(arg1), /* 1295 E> */ B(Ldar), R(arg1),
/* 1292 E> */ B(LdrKeyedProperty), R(arg0), U8(211), R(0), B(LdrKeyedProperty), R(arg0), U8(211), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1302 S> */ B(Nop), /* 1302 S> */ B(Nop),
/* 1307 E> */ B(Ldar), R(arg1), /* 1307 E> */ B(Ldar), R(arg1),
/* 1304 E> */ B(LdrKeyedProperty), R(arg0), U8(213), R(0), B(LdrKeyedProperty), R(arg0), U8(213), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1314 S> */ B(Nop), /* 1314 S> */ B(Nop),
/* 1319 E> */ B(Ldar), R(arg1), /* 1319 E> */ B(Ldar), R(arg1),
/* 1316 E> */ B(LdrKeyedProperty), R(arg0), U8(215), R(0), B(LdrKeyedProperty), R(arg0), U8(215), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1326 S> */ B(Nop), /* 1326 S> */ B(Nop),
/* 1331 E> */ B(Ldar), R(arg1), /* 1331 E> */ B(Ldar), R(arg1),
/* 1328 E> */ B(LdrKeyedProperty), R(arg0), U8(217), R(0), B(LdrKeyedProperty), R(arg0), U8(217), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1338 S> */ B(Nop), /* 1338 S> */ B(Nop),
/* 1343 E> */ B(Ldar), R(arg1), /* 1343 E> */ B(Ldar), R(arg1),
/* 1340 E> */ B(LdrKeyedProperty), R(arg0), U8(219), R(0), B(LdrKeyedProperty), R(arg0), U8(219), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1350 S> */ B(Nop), /* 1350 S> */ B(Nop),
/* 1355 E> */ B(Ldar), R(arg1), /* 1355 E> */ B(Ldar), R(arg1),
/* 1352 E> */ B(LdrKeyedProperty), R(arg0), U8(221), R(0), B(LdrKeyedProperty), R(arg0), U8(221), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1362 S> */ B(Nop), /* 1362 S> */ B(Nop),
/* 1367 E> */ B(Ldar), R(arg1), /* 1367 E> */ B(Ldar), R(arg1),
/* 1364 E> */ B(LdrKeyedProperty), R(arg0), U8(223), R(0), B(LdrKeyedProperty), R(arg0), U8(223), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1374 S> */ B(Nop), /* 1374 S> */ B(Nop),
/* 1379 E> */ B(Ldar), R(arg1), /* 1379 E> */ B(Ldar), R(arg1),
/* 1376 E> */ B(LdrKeyedProperty), R(arg0), U8(225), R(0), B(LdrKeyedProperty), R(arg0), U8(225), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1386 S> */ B(Nop), /* 1386 S> */ B(Nop),
/* 1391 E> */ B(Ldar), R(arg1), /* 1391 E> */ B(Ldar), R(arg1),
/* 1388 E> */ B(LdrKeyedProperty), R(arg0), U8(227), R(0), B(LdrKeyedProperty), R(arg0), U8(227), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1398 S> */ B(Nop), /* 1398 S> */ B(Nop),
/* 1403 E> */ B(Ldar), R(arg1), /* 1403 E> */ B(Ldar), R(arg1),
/* 1400 E> */ B(LdrKeyedProperty), R(arg0), U8(229), R(0), B(LdrKeyedProperty), R(arg0), U8(229), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1410 S> */ B(Nop), /* 1410 S> */ B(Nop),
/* 1415 E> */ B(Ldar), R(arg1), /* 1415 E> */ B(Ldar), R(arg1),
/* 1412 E> */ B(LdrKeyedProperty), R(arg0), U8(231), R(0), B(LdrKeyedProperty), R(arg0), U8(231), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1422 S> */ B(Nop), /* 1422 S> */ B(Nop),
/* 1427 E> */ B(Ldar), R(arg1), /* 1427 E> */ B(Ldar), R(arg1),
/* 1424 E> */ B(LdrKeyedProperty), R(arg0), U8(233), R(0), B(LdrKeyedProperty), R(arg0), U8(233), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1434 S> */ B(Nop), /* 1434 S> */ B(Nop),
/* 1439 E> */ B(Ldar), R(arg1), /* 1439 E> */ B(Ldar), R(arg1),
/* 1436 E> */ B(LdrKeyedProperty), R(arg0), U8(235), R(0), B(LdrKeyedProperty), R(arg0), U8(235), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1446 S> */ B(Nop), /* 1446 S> */ B(Nop),
/* 1451 E> */ B(Ldar), R(arg1), /* 1451 E> */ B(Ldar), R(arg1),
/* 1448 E> */ B(LdrKeyedProperty), R(arg0), U8(237), R(0), B(LdrKeyedProperty), R(arg0), U8(237), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1458 S> */ B(Nop), /* 1458 S> */ B(Nop),
/* 1463 E> */ B(Ldar), R(arg1), /* 1463 E> */ B(Ldar), R(arg1),
/* 1460 E> */ B(LdrKeyedProperty), R(arg0), U8(239), R(0), B(LdrKeyedProperty), R(arg0), U8(239), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1470 S> */ B(Nop), /* 1470 S> */ B(Nop),
/* 1475 E> */ B(Ldar), R(arg1), /* 1475 E> */ B(Ldar), R(arg1),
/* 1472 E> */ B(LdrKeyedProperty), R(arg0), U8(241), R(0), B(LdrKeyedProperty), R(arg0), U8(241), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1482 S> */ B(Nop), /* 1482 S> */ B(Nop),
/* 1487 E> */ B(Ldar), R(arg1), /* 1487 E> */ B(Ldar), R(arg1),
/* 1484 E> */ B(LdrKeyedProperty), R(arg0), U8(243), R(0), B(LdrKeyedProperty), R(arg0), U8(243), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1494 S> */ B(Nop), /* 1494 S> */ B(Nop),
/* 1499 E> */ B(Ldar), R(arg1), /* 1499 E> */ B(Ldar), R(arg1),
/* 1496 E> */ B(LdrKeyedProperty), R(arg0), U8(245), R(0), B(LdrKeyedProperty), R(arg0), U8(245), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1506 S> */ B(Nop), /* 1506 S> */ B(Nop),
/* 1511 E> */ B(Ldar), R(arg1), /* 1511 E> */ B(Ldar), R(arg1),
/* 1508 E> */ B(LdrKeyedProperty), R(arg0), U8(247), R(0), B(LdrKeyedProperty), R(arg0), U8(247), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1518 S> */ B(Nop), /* 1518 S> */ B(Nop),
/* 1523 E> */ B(Ldar), R(arg1), /* 1523 E> */ B(Ldar), R(arg1),
/* 1520 E> */ B(LdrKeyedProperty), R(arg0), U8(249), R(0), B(LdrKeyedProperty), R(arg0), U8(249), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1530 S> */ B(Nop), /* 1530 S> */ B(Nop),
/* 1535 E> */ B(Ldar), R(arg1), /* 1535 E> */ B(Ldar), R(arg1),
/* 1532 E> */ B(LdrKeyedProperty), R(arg0), U8(251), R(0), B(LdrKeyedProperty), R(arg0), U8(251), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1542 S> */ B(Nop), /* 1542 S> */ B(Nop),
/* 1547 E> */ B(Ldar), R(arg1), /* 1547 E> */ B(Ldar), R(arg1),
/* 1544 E> */ B(LdrKeyedProperty), R(arg0), U8(253), R(0), B(LdrKeyedProperty), R(arg0), U8(253), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1554 S> */ B(Nop), /* 1554 S> */ B(Nop),
/* 1559 E> */ B(Ldar), R(arg1), /* 1559 E> */ B(Ldar), R(arg1),
/* 1556 E> */ B(LdrKeyedProperty), R(arg0), U8(255), R(0), B(LdrKeyedProperty), R(arg0), U8(255), R(0),
B(Ldar), R(0), B(Ldar), R(0),
/* 1566 S> */ B(Nop), /* 1566 S> */ B(Nop),
/* 1574 E> */ B(Ldar), R(arg1), /* 1574 E> */ B(Ldar), R(arg1),

View File

@ -109,7 +109,7 @@ bytecodes: [
B(Star), R(3), B(Star), R(3),
B(LdaSmi), U8(1), B(LdaSmi), U8(1),
B(Sub), R(3), B(Sub), R(3),
/* 56 E> */ B(LdrUndefined), R(1), B(LdrUndefined), R(1),
B(Ldar), R(1), B(Ldar), R(1),
/* 74 S> */ B(Nop), /* 74 S> */ B(Nop),
/* 84 S> */ B(Return), /* 84 S> */ B(Return),

View File

@ -0,0 +1,225 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "test/cctest/interpreter/source-position-matcher.h"
#include "src/objects-inl.h"
#include "src/objects.h"
namespace v8 {
namespace internal {
namespace interpreter {
// Comparer for PositionTableEntry instances.
struct PositionTableEntryComparer {
bool operator()(const PositionTableEntry& lhs,
const PositionTableEntry& rhs) {
int lhs_type_score = type_score(lhs);
int rhs_type_score = type_score(rhs);
if (lhs_type_score == rhs_type_score) {
return lhs.source_position < rhs.source_position;
} else {
return lhs_type_score < rhs_type_score;
}
}
int type_score(const PositionTableEntry& entry) {
return entry.is_statement ? 1 : 0;
}
};
//
// The principles for comparing source positions in bytecode arrays
// are:
//
// 1. The number of statement positions must be the same in both.
//
// 2. Statement positions may be moved provide they do not affect the
// debuggers causal view of the v8 heap and local state. This means
// statement positions may be moved when their initial position is
// on bytecodes that manipulate the accumulator and temporary
// registers.
//
// 3. When duplicate expression positions are present, either may
// be dropped.
//
// 4. Expression positions may be applied to later bytecodes in the
// bytecode array if the current bytecode does not throw.
//
// 5. Expression positions may be dropped when they are applied to
// bytecodes that manipulate local frame state and immediately
// proceeded by another source position.
//
// 6. The relative ordering of source positions must be preserved.
//
bool SourcePositionMatcher::Match(Handle<BytecodeArray> original_bytecode,
Handle<BytecodeArray> optimized_bytecode) {
SourcePositionTableIterator original(
original_bytecode->source_position_table());
SourcePositionTableIterator optimized(
optimized_bytecode->source_position_table());
int last_original_bytecode_offset = 0;
int last_optimized_bytecode_offset = 0;
// Ordered lists of expression positions immediately before the
// latest statements in each bytecode array.
std::vector<PositionTableEntry> original_expression_entries;
std::vector<PositionTableEntry> optimized_expression_entries;
while (true) {
MoveToNextStatement(&original, &original_expression_entries);
MoveToNextStatement(&optimized, &optimized_expression_entries);
if (original.done() && optimized.done()) {
return true;
} else if (original.done()) {
return false;
} else if (optimized.done()) {
return false;
}
if (HasNewExpressionPositionsInOptimized(&original_expression_entries,
&optimized_expression_entries)) {
return false;
}
StripUnneededExpressionPositions(original_bytecode,
&original_expression_entries,
original.bytecode_offset());
StripUnneededExpressionPositions(optimized_bytecode,
&optimized_expression_entries,
optimized.bytecode_offset());
if (!CompareExpressionPositions(&original_expression_entries,
&optimized_expression_entries)) {
// Message logged in CompareExpressionPositions().
return false;
}
// Check original and optimized have matching source positions.
if (original.source_position() != optimized.source_position()) {
return false;
}
if (original.bytecode_offset() < last_original_bytecode_offset) {
return false;
}
last_original_bytecode_offset = original.bytecode_offset();
if (optimized.bytecode_offset() < last_optimized_bytecode_offset) {
return false;
}
last_optimized_bytecode_offset = optimized.bytecode_offset();
// TODO(oth): Can we compare statement positions are semantically
// equivalent? e.g. before a bytecode that has debugger observable
// effects. This is likely non-trivial.
}
return true;
}
bool SourcePositionMatcher::HasNewExpressionPositionsInOptimized(
const std::vector<PositionTableEntry>* const original_positions,
const std::vector<PositionTableEntry>* const optimized_positions) {
std::set<PositionTableEntry, PositionTableEntryComparer> original_set(
original_positions->begin(), original_positions->end());
bool retval = false;
for (auto optimized_position : *optimized_positions) {
if (original_set.find(optimized_position) == original_set.end()) {
retval = true;
}
}
return retval;
}
bool SourcePositionMatcher::CompareExpressionPositions(
const std::vector<PositionTableEntry>* const original_positions,
const std::vector<PositionTableEntry>* const optimized_positions) {
if (original_positions->size() != optimized_positions->size()) {
return false;
}
if (original_positions->size() == 0) {
return true;
}
for (size_t i = 0; i < original_positions->size(); ++i) {
PositionTableEntry original = original_positions->at(i);
PositionTableEntry optimized = original_positions->at(i);
CHECK(original.source_position > 0);
if ((original.is_statement || optimized.is_statement) ||
(original.source_position != optimized.source_position) ||
(original.source_position < 0)) {
return false;
}
}
return true;
}
void SourcePositionMatcher::StripUnneededExpressionPositions(
Handle<BytecodeArray> bytecode_array,
std::vector<PositionTableEntry>* expression_positions,
int next_statement_bytecode_offset) {
size_t j = 0;
for (size_t i = 0; i < expression_positions->size(); ++i) {
CHECK(expression_positions->at(i).source_position > 0 &&
!expression_positions->at(i).is_statement);
int bytecode_end = (i == expression_positions->size() - 1)
? next_statement_bytecode_offset
: expression_positions->at(i + 1).bytecode_offset;
if (ExpressionPositionIsNeeded(bytecode_array,
expression_positions->at(i).bytecode_offset,
bytecode_end)) {
expression_positions->at(j++) = expression_positions->at(i);
}
}
expression_positions->resize(j);
}
void SourcePositionMatcher::AdvanceBytecodeIterator(
BytecodeArrayIterator* iterator, int bytecode_offset) {
while (iterator->current_offset() != bytecode_offset) {
iterator->Advance();
}
}
bool SourcePositionMatcher::ExpressionPositionIsNeeded(
Handle<BytecodeArray> bytecode_array, int start_offset, int end_offset) {
CHECK_GT(end_offset, start_offset);
BytecodeArrayIterator iterator(bytecode_array);
AdvanceBytecodeIterator(&iterator, start_offset);
while (iterator.current_offset() != end_offset) {
if (Bytecodes::IsWithoutExternalSideEffects(iterator.current_bytecode())) {
iterator.Advance();
} else {
// Bytecode could throw so need an expression position.
return true;
}
}
return false;
}
void SourcePositionMatcher::MoveToNextStatement(
SourcePositionTableIterator* iterator,
std::vector<PositionTableEntry>* positions) {
iterator->Advance();
positions->clear();
while (!iterator->done()) {
if (iterator->is_statement()) {
break;
}
positions->push_back({iterator->bytecode_offset(),
iterator->source_position(),
iterator->is_statement()});
iterator->Advance();
}
}
} // namespace interpreter
} // namespace internal
} // namespace v8

View File

@ -0,0 +1,50 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TEST_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_
#define TEST_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_
#include "src/interpreter/bytecode-array-iterator.h"
#include "src/interpreter/source-position-table.h"
#include "src/objects.h"
#include "src/v8.h"
namespace v8 {
namespace internal {
namespace interpreter {
class SourcePositionMatcher final {
public:
bool Match(Handle<BytecodeArray> original, Handle<BytecodeArray> optimized);
private:
bool HasNewExpressionPositionsInOptimized(
const std::vector<PositionTableEntry>* const original_positions,
const std::vector<PositionTableEntry>* const optimized_positions);
bool CompareExpressionPositions(
const std::vector<PositionTableEntry>* const original_positions,
const std::vector<PositionTableEntry>* const optimized_positions);
void StripUnneededExpressionPositions(
Handle<BytecodeArray> bytecode_array,
std::vector<PositionTableEntry>* positions,
int next_statement_bytecode_offset);
bool ExpressionPositionIsNeeded(Handle<BytecodeArray> bytecode_array,
int start_offset, int end_offset);
void MoveToNextStatement(
SourcePositionTableIterator* iterator,
std::vector<PositionTableEntry>* expression_positions);
void AdvanceBytecodeIterator(BytecodeArrayIterator* iterator,
int bytecode_offset);
};
} // namespace interpreter
} // namespace internal
} // namespace v8
#endif // TEST_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_

View File

@ -0,0 +1,237 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/v8.h"
#include "src/compiler/pipeline.h"
#include "src/handles.h"
#include "src/interpreter/bytecode-generator.h"
#include "src/interpreter/interpreter.h"
#include "src/isolate.h"
#include "src/parsing/parser.h"
#include "test/cctest/cctest.h"
#include "test/cctest/interpreter/source-position-matcher.h"
namespace v8 {
namespace internal {
namespace interpreter {
// Flags enabling optimizations that change generated bytecode array.
// Format is <command-line flag> <flag name> <bit index>
#define OPTIMIZATION_FLAGS(V) \
V(FLAG_ignition_reo, kUseReo, 0) \
V(FLAG_ignition_peephole, kUsePeephole, 1)
#define DECLARE_BIT(_, Name, BitIndex) static const int Name = 1 << BitIndex;
OPTIMIZATION_FLAGS(DECLARE_BIT)
#undef DECLARE_BIT
// Test cases source positions are checked for. Please ensure all
// combinations of flags are present here. This is done manually
// because it provides easier to comprehend failure case for humans.
#define TEST_CASES(V) \
V(UsingReo, kUseReo) \
V(UsingReoAndPeephole, kUseReo | kUsePeephole) \
V(UsingPeephole, kUsePeephole)
static const char* kTestScripts[] = {
"var x = (y = 3) + (x = y); return x + y;",
"var x = 55;\n"
"var y = x + (x = 1) + (x = 2) + (x = 3);\n"
"return y;",
"var x = 10; return x >>> 3;",
"var x = 0; return x || (1, 2, 3);",
"return a || (a, b, a, b, c = 5, 3); ",
"var a = 3; var b = 4; a = b; b = a; a = b; return a;",
"var a = 1; return [[a, 2], [a + 2]];",
"var a = 1; if (a || a < 0) { return 1; }",
"var b;"
"b = a.name;"
"b = a.name;"
"a.name = a;"
"b = a.name;"
"a.name = a;"
"return b;",
"var sum = 0;\n"
"outer: {\n"
" for (var x = 0; x < 10; ++x) {\n"
" for (var y = 0; y < 3; ++y) {\n"
" ++sum;\n"
" if (x + y == 12) { break outer; }\n"
" }\n"
" }\n"
"}\n"
"return sum;\n",
"var a = 1;"
"switch (a) {"
" case 1: return a * a + 1;"
" case 1: break;"
" case 2: return (a = 3) * a + (a = 4);"
" case 3:"
"}"
"return a;",
"for (var p of [0, 1, 2]) {}",
"var x = { 'a': 1, 'b': 2 };"
"for (x['a'] of [1,2,3]) { return x['a']; }",
"while (x == 4) {\n"
" var y = x + 1;\n"
" if (y == 2) break;\n"
" for (z['a'] of [0]) {\n"
" x += (x *= 3) + y;"
" }\n"
"}\n",
"function g(a, b) { return a.func(b + b, b); }\n"
"g(new (function Obj() { this.func = function() { return; }})(), 1)\n"};
class OptimizedBytecodeSourcePositionTester final {
public:
explicit OptimizedBytecodeSourcePositionTester(Isolate* isolate)
: isolate_(isolate) {
SaveOptimizationFlags();
saved_flag_ignition_ = FLAG_ignition;
FLAG_ignition = true;
saved_flag_always_opt_ = FLAG_always_opt;
FLAG_always_opt = false;
}
~OptimizedBytecodeSourcePositionTester() {
RestoreOptimizationFlags();
FLAG_ignition = saved_flag_ignition_;
FLAG_always_opt = saved_flag_always_opt_;
}
bool SourcePositionsMatch(int optimization_bitmap, const char* function_body,
const char* function_decl_params = "",
const char* function_args = "");
private:
Handle<BytecodeArray> MakeBytecode(int optimization_bitmap,
const char* function_body,
const char* function_decl_params,
const char* function_args);
static std::string MakeFunctionName(int optimization_bitmap);
static std::string MakeScript(const char* function_name,
const char* function_body,
const char* function_decl_params,
const char* function_args);
void SetOptimizationFlags(int optimization_bitmap);
void SaveOptimizationFlags();
void RestoreOptimizationFlags();
Isolate* isolate() const { return isolate_; }
Isolate* isolate_;
int saved_optimization_bitmap_;
bool saved_flag_ignition_;
bool saved_flag_always_opt_;
};
// static
std::string OptimizedBytecodeSourcePositionTester::MakeFunctionName(
int optimization_bitmap) {
std::ostringstream os;
os << "test_function_" << optimization_bitmap;
return os.str();
}
// static
std::string OptimizedBytecodeSourcePositionTester::MakeScript(
const char* function_name, const char* function_body,
const char* function_decl_params, const char* function_args) {
std::ostringstream os;
os << "function " << function_name << "(" << function_decl_params << ") {";
os << function_body;
os << "}";
os << function_name << "(" << function_args << ");";
return os.str();
}
Handle<BytecodeArray> OptimizedBytecodeSourcePositionTester::MakeBytecode(
int optimization_bitmap, const char* function_body,
const char* function_decl_params, const char* function_args) {
std::string function_name = MakeFunctionName(optimization_bitmap);
std::string script = MakeScript(function_name.c_str(), function_body,
function_decl_params, function_args);
SetOptimizationFlags(optimization_bitmap);
CompileRun(script.c_str());
Local<Function> api_function =
Local<Function>::Cast(CcTest::global()
->Get(CcTest::isolate()->GetCurrentContext(),
v8_str(function_name.c_str()))
.ToLocalChecked());
Handle<JSFunction> function =
Handle<JSFunction>::cast(v8::Utils::OpenHandle(*api_function));
return handle(function->shared()->bytecode_array());
}
void OptimizedBytecodeSourcePositionTester::SetOptimizationFlags(
int optimization_bitmap) {
#define SET_FLAG(V8Flag, BitName, _) \
V8Flag = (optimization_bitmap & BitName) ? true : false;
OPTIMIZATION_FLAGS(SET_FLAG)
#undef SET_FLAG
}
void OptimizedBytecodeSourcePositionTester::SaveOptimizationFlags() {
saved_optimization_bitmap_ = 0;
#define SAVE_FLAG(V8Flag, BitName, _) \
if (V8Flag) saved_optimization_bitmap_ |= BitName;
#undef SET_FLAG
}
void OptimizedBytecodeSourcePositionTester::RestoreOptimizationFlags() {
SetOptimizationFlags(saved_optimization_bitmap_);
}
bool OptimizedBytecodeSourcePositionTester::SourcePositionsMatch(
int optimization_bitmap, const char* function_body,
const char* function_decl_params, const char* function_args) {
Handle<BytecodeArray> unoptimized_bytecode =
MakeBytecode(0, function_body, function_decl_params, function_args);
Handle<BytecodeArray> optimized_bytecode = MakeBytecode(
optimization_bitmap, function_body, function_decl_params, function_args);
SourcePositionMatcher matcher;
if (!matcher.Match(unoptimized_bytecode, optimized_bytecode)) {
return false;
}
return true;
}
void TestSourcePositionsEquivalent(int optimization_bitmap) {
HandleAndZoneScope handles;
// Ensure handler table is generated.
handles.main_isolate()->interpreter()->Initialize();
OptimizedBytecodeSourcePositionTester tester(handles.main_isolate());
for (auto test_script : kTestScripts) {
CHECK(tester.SourcePositionsMatch(optimization_bitmap, test_script));
}
}
#define MAKE_TEST(Name, Bitmap) \
TEST(TestSourcePositionsEquivalent##Name) { \
TestSourcePositionsEquivalent(Bitmap); \
}
TEST_CASES(MAKE_TEST)
#undef MAKE_TEST
} // namespace interpreter
} // namespace internal
} // namespace v8