[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
// 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/bytecode-expectations-printer.h"
|
|
|
|
|
2016-05-11 12:21:56 +00:00
|
|
|
#include <iomanip>
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
#include <iostream>
|
2016-02-19 12:36:26 +00:00
|
|
|
#include <vector>
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
|
|
|
|
#include "include/libplatform/libplatform.h"
|
|
|
|
#include "include/v8.h"
|
2019-05-17 12:13:44 +00:00
|
|
|
#include "src/api/api-inl.h"
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
#include "src/base/logging.h"
|
2019-05-21 09:30:15 +00:00
|
|
|
#include "src/codegen/source-position-table.h"
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
#include "src/interpreter/bytecode-array-iterator.h"
|
|
|
|
#include "src/interpreter/bytecode-generator.h"
|
|
|
|
#include "src/interpreter/bytecodes.h"
|
2016-06-21 14:37:16 +00:00
|
|
|
#include "src/interpreter/interpreter-intrinsics.h"
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
#include "src/interpreter/interpreter.h"
|
2018-12-17 17:01:48 +00:00
|
|
|
#include "src/objects/heap-number-inl.h"
|
2018-05-23 13:29:02 +00:00
|
|
|
#include "src/objects/module-inl.h"
|
2019-05-23 08:51:46 +00:00
|
|
|
#include "src/objects/objects-inl.h"
|
2018-05-23 13:29:02 +00:00
|
|
|
#include "src/runtime/runtime.h"
|
2019-05-23 13:27:57 +00:00
|
|
|
#include "src/utils/ostreams.h"
|
2018-08-07 13:14:23 +00:00
|
|
|
#include "test/cctest/cctest.h"
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
namespace interpreter {
|
|
|
|
|
2016-12-21 16:41:11 +00:00
|
|
|
static const char* NameForNativeContextIntrinsicIndex(uint32_t idx) {
|
|
|
|
switch (idx) {
|
|
|
|
#define COMPARE_NATIVE_CONTEXT_INTRINSIC_IDX(NAME, Type, name) \
|
|
|
|
case Context::NAME: \
|
|
|
|
return #name;
|
|
|
|
|
|
|
|
NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(COMPARE_NATIVE_CONTEXT_INTRINSIC_IDX)
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "UnknownIntrinsicIndex";
|
|
|
|
}
|
|
|
|
|
2016-02-19 12:36:26 +00:00
|
|
|
// static
|
|
|
|
const char* const BytecodeExpectationsPrinter::kDefaultTopFunctionName =
|
|
|
|
"__genbckexp_wrapper__";
|
2016-05-11 12:21:56 +00:00
|
|
|
const char* const BytecodeExpectationsPrinter::kIndent = " ";
|
2016-02-19 12:36:26 +00:00
|
|
|
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
v8::Local<v8::String> BytecodeExpectationsPrinter::V8StringFromUTF8(
|
|
|
|
const char* data) const {
|
2020-03-09 10:41:45 +00:00
|
|
|
return v8::String::NewFromUtf8(isolate_, data).ToLocalChecked();
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string BytecodeExpectationsPrinter::WrapCodeInFunction(
|
|
|
|
const char* function_name, const std::string& function_body) const {
|
|
|
|
std::ostringstream program_stream;
|
|
|
|
program_stream << "function " << function_name << "() {" << function_body
|
|
|
|
<< "}\n"
|
|
|
|
<< function_name << "();";
|
|
|
|
|
|
|
|
return program_stream.str();
|
|
|
|
}
|
|
|
|
|
2016-10-04 18:42:13 +00:00
|
|
|
v8::Local<v8::Script> BytecodeExpectationsPrinter::CompileScript(
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
const char* program) const {
|
|
|
|
v8::Local<v8::String> source = V8StringFromUTF8(program);
|
2016-02-19 12:36:26 +00:00
|
|
|
return v8::Script::Compile(isolate_->GetCurrentContext(), source)
|
|
|
|
.ToLocalChecked();
|
|
|
|
}
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
|
2016-10-04 18:42:13 +00:00
|
|
|
v8::Local<v8::Module> BytecodeExpectationsPrinter::CompileModule(
|
|
|
|
const char* program) const {
|
2021-01-12 11:54:50 +00:00
|
|
|
ScriptOrigin origin(isolate_, Local<v8::Value>(), 0, 0, false, -1,
|
|
|
|
Local<v8::Value>(), false, false, true);
|
2017-01-19 06:59:20 +00:00
|
|
|
v8::ScriptCompiler::Source source(V8StringFromUTF8(program), origin);
|
2016-10-04 18:42:13 +00:00
|
|
|
return v8::ScriptCompiler::CompileModule(isolate_, &source).ToLocalChecked();
|
|
|
|
}
|
|
|
|
|
2016-02-19 12:36:26 +00:00
|
|
|
void BytecodeExpectationsPrinter::Run(v8::Local<v8::Script> script) const {
|
2018-04-13 22:28:05 +00:00
|
|
|
MaybeLocal<Value> result = script->Run(isolate_->GetCurrentContext());
|
|
|
|
USE(result);
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
i::Handle<v8::internal::BytecodeArray>
|
|
|
|
BytecodeExpectationsPrinter::GetBytecodeArrayForGlobal(
|
|
|
|
const char* global_name) const {
|
|
|
|
const v8::Local<v8::Context>& context = isolate_->GetCurrentContext();
|
|
|
|
v8::Local<v8::String> v8_global_name = V8StringFromUTF8(global_name);
|
|
|
|
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
|
|
|
|
context->Global()->Get(context, v8_global_name).ToLocalChecked());
|
|
|
|
i::Handle<i::JSFunction> js_function =
|
|
|
|
i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*function));
|
|
|
|
|
2020-12-17 16:02:56 +00:00
|
|
|
i::Handle<i::BytecodeArray> bytecodes = i::handle(
|
|
|
|
js_function->shared().GetBytecodeArray(i_isolate()), i_isolate());
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
|
|
|
|
return bytecodes;
|
|
|
|
}
|
|
|
|
|
2016-10-04 18:42:13 +00:00
|
|
|
i::Handle<i::BytecodeArray>
|
|
|
|
BytecodeExpectationsPrinter::GetBytecodeArrayForModule(
|
|
|
|
v8::Local<v8::Module> module) const {
|
|
|
|
i::Handle<i::Module> i_module = v8::Utils::OpenHandle(*module);
|
2019-06-19 17:07:58 +00:00
|
|
|
return i::handle(SharedFunctionInfo::cast(
|
|
|
|
Handle<i::SourceTextModule>::cast(i_module)->code())
|
2020-12-17 16:02:56 +00:00
|
|
|
.GetBytecodeArray(i_isolate()),
|
2019-06-19 17:07:58 +00:00
|
|
|
i_isolate());
|
2016-10-04 18:42:13 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 12:36:26 +00:00
|
|
|
i::Handle<i::BytecodeArray>
|
|
|
|
BytecodeExpectationsPrinter::GetBytecodeArrayForScript(
|
|
|
|
v8::Local<v8::Script> script) const {
|
|
|
|
i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*script);
|
2020-12-17 16:02:56 +00:00
|
|
|
return i::handle(js_function->shared().GetBytecodeArray(i_isolate()),
|
|
|
|
i_isolate());
|
2016-02-19 12:36:26 +00:00
|
|
|
}
|
|
|
|
|
2018-08-07 13:14:23 +00:00
|
|
|
i::Handle<i::BytecodeArray>
|
|
|
|
BytecodeExpectationsPrinter::GetBytecodeArrayOfCallee(
|
|
|
|
const char* source_code) const {
|
|
|
|
i::Handle<i::Object> i_object =
|
|
|
|
v8::Utils::OpenHandle(*CompileRun(source_code));
|
|
|
|
i::Handle<i::JSFunction> js_function =
|
|
|
|
i::Handle<i::JSFunction>::cast(i_object);
|
|
|
|
CHECK(js_function->shared().HasBytecodeArray());
|
2020-12-17 16:02:56 +00:00
|
|
|
return i::handle(js_function->shared().GetBytecodeArray(i_isolate()),
|
|
|
|
i_isolate());
|
2018-08-07 13:14:23 +00:00
|
|
|
}
|
|
|
|
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
void BytecodeExpectationsPrinter::PrintEscapedString(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, const std::string& string) const {
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
for (char c : string) {
|
|
|
|
switch (c) {
|
|
|
|
case '"':
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "\\\"";
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
break;
|
|
|
|
case '\\':
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "\\\\";
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
break;
|
|
|
|
default:
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << c;
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeExpectationsPrinter::PrintBytecodeOperand(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, const BytecodeArrayIterator& bytecode_iterator,
|
2016-02-19 12:36:26 +00:00
|
|
|
const Bytecode& bytecode, int op_index, int parameter_count) const {
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
OperandType op_type = Bytecodes::GetOperandType(bytecode, op_index);
|
2016-03-21 17:08:21 +00:00
|
|
|
OperandSize op_size = Bytecodes::GetOperandSize(
|
2016-05-11 12:21:56 +00:00
|
|
|
bytecode, op_index, bytecode_iterator.current_operand_scale());
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
|
|
|
|
const char* size_tag;
|
|
|
|
switch (op_size) {
|
|
|
|
case OperandSize::kByte:
|
|
|
|
size_tag = "8";
|
|
|
|
break;
|
|
|
|
case OperandSize::kShort:
|
|
|
|
size_tag = "16";
|
|
|
|
break;
|
2016-03-21 17:08:21 +00:00
|
|
|
case OperandSize::kQuad:
|
|
|
|
size_tag = "32";
|
|
|
|
break;
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
default:
|
|
|
|
UNREACHABLE();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Bytecodes::IsRegisterOperandType(op_type)) {
|
2016-05-11 12:21:56 +00:00
|
|
|
Register register_value = bytecode_iterator.GetRegisterOperand(op_index);
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << 'R';
|
|
|
|
if (op_size != OperandSize::kByte) *stream << size_tag;
|
2017-08-11 15:16:31 +00:00
|
|
|
if (register_value.is_current_context()) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "(context)";
|
2016-02-19 12:36:26 +00:00
|
|
|
} else if (register_value.is_function_closure()) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "(closure)";
|
2016-02-19 12:36:26 +00:00
|
|
|
} else if (register_value.is_parameter()) {
|
|
|
|
int parameter_index = register_value.ToParameterIndex(parameter_count);
|
|
|
|
if (parameter_index == 0) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "(this)";
|
2016-02-19 12:36:26 +00:00
|
|
|
} else {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "(arg" << (parameter_index - 1) << ')';
|
2016-02-19 12:36:26 +00:00
|
|
|
}
|
|
|
|
} else {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << '(' << register_value.index() << ')';
|
2016-02-19 12:36:26 +00:00
|
|
|
}
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
} else {
|
2016-03-21 17:08:21 +00:00
|
|
|
switch (op_type) {
|
|
|
|
case OperandType::kFlag8:
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << 'U' << size_tag << '(';
|
|
|
|
*stream << bytecode_iterator.GetFlagOperand(op_index);
|
2016-03-21 17:08:21 +00:00
|
|
|
break;
|
2016-12-21 16:41:11 +00:00
|
|
|
case OperandType::kIdx: {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << 'U' << size_tag << '(';
|
|
|
|
*stream << bytecode_iterator.GetIndexOperand(op_index);
|
2016-03-21 17:08:21 +00:00
|
|
|
break;
|
2016-12-21 16:41:11 +00:00
|
|
|
}
|
2016-09-13 14:48:39 +00:00
|
|
|
case OperandType::kUImm:
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << 'U' << size_tag << '(';
|
|
|
|
*stream << bytecode_iterator.GetUnsignedImmediateOperand(op_index);
|
2016-09-13 14:48:39 +00:00
|
|
|
break;
|
2016-03-21 17:08:21 +00:00
|
|
|
case OperandType::kImm:
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << 'I' << size_tag << '(';
|
|
|
|
*stream << bytecode_iterator.GetImmediateOperand(op_index);
|
2016-03-21 17:08:21 +00:00
|
|
|
break;
|
|
|
|
case OperandType::kRegCount:
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << 'U' << size_tag << '(';
|
|
|
|
*stream << bytecode_iterator.GetRegisterCountOperand(op_index);
|
2016-03-21 17:08:21 +00:00
|
|
|
break;
|
|
|
|
case OperandType::kRuntimeId: {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << 'U' << size_tag << '(';
|
2016-06-21 14:37:16 +00:00
|
|
|
Runtime::FunctionId id =
|
|
|
|
bytecode_iterator.GetRuntimeIdOperand(op_index);
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "Runtime::k" << i::Runtime::FunctionForId(id)->name;
|
2016-06-21 14:37:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OperandType::kIntrinsicId: {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << 'U' << size_tag << '(';
|
2016-06-21 14:37:16 +00:00
|
|
|
Runtime::FunctionId id =
|
|
|
|
bytecode_iterator.GetIntrinsicIdOperand(op_index);
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "Runtime::k" << i::Runtime::FunctionForId(id)->name;
|
2016-03-21 17:08:21 +00:00
|
|
|
break;
|
2017-09-05 11:23:26 +00:00
|
|
|
}
|
|
|
|
case OperandType::kNativeContextIndex: {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << 'U' << size_tag << '(';
|
2017-09-05 11:23:26 +00:00
|
|
|
uint32_t idx = bytecode_iterator.GetNativeContextIndexOperand(op_index);
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "%" << NameForNativeContextIntrinsicIndex(idx);
|
2017-09-05 11:23:26 +00:00
|
|
|
break;
|
2016-03-21 17:08:21 +00:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
UNREACHABLE();
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << ')';
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeExpectationsPrinter::PrintBytecode(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, const BytecodeArrayIterator& bytecode_iterator,
|
2016-02-19 12:36:26 +00:00
|
|
|
int parameter_count) const {
|
2016-05-11 12:21:56 +00:00
|
|
|
Bytecode bytecode = bytecode_iterator.current_bytecode();
|
|
|
|
OperandScale operand_scale = bytecode_iterator.current_operand_scale();
|
2016-03-21 17:08:21 +00:00
|
|
|
if (Bytecodes::OperandScaleRequiresPrefixBytecode(operand_scale)) {
|
|
|
|
Bytecode prefix = Bytecodes::OperandScaleToPrefixBytecode(operand_scale);
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "B(" << Bytecodes::ToString(prefix) << "), ";
|
2016-03-21 17:08:21 +00:00
|
|
|
}
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "B(" << Bytecodes::ToString(bytecode) << ')';
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
int operands_count = Bytecodes::NumberOfOperands(bytecode);
|
|
|
|
for (int op_index = 0; op_index < operands_count; ++op_index) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << ", ";
|
2016-05-11 12:21:56 +00:00
|
|
|
PrintBytecodeOperand(stream, bytecode_iterator, bytecode, op_index,
|
2016-02-19 12:36:26 +00:00
|
|
|
parameter_count);
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-11 12:21:56 +00:00
|
|
|
void BytecodeExpectationsPrinter::PrintSourcePosition(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, SourcePositionTableIterator* source_iterator,
|
2016-05-11 12:21:56 +00:00
|
|
|
int bytecode_offset) const {
|
|
|
|
static const size_t kPositionWidth = 4;
|
2019-09-10 01:19:59 +00:00
|
|
|
if (!source_iterator->done() &&
|
|
|
|
source_iterator->code_offset() == bytecode_offset) {
|
|
|
|
*stream << "/* " << std::setw(kPositionWidth)
|
|
|
|
<< source_iterator->source_position().ScriptOffset();
|
|
|
|
if (source_iterator->is_statement()) {
|
|
|
|
*stream << " S> */ ";
|
2016-05-11 12:21:56 +00:00
|
|
|
} else {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << " E> */ ";
|
2016-05-11 12:21:56 +00:00
|
|
|
}
|
2019-09-10 01:19:59 +00:00
|
|
|
source_iterator->Advance();
|
2016-05-11 12:21:56 +00:00
|
|
|
} else {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << " " << std::setw(kPositionWidth) << ' ' << " ";
|
2016-05-11 12:21:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-10 01:19:59 +00:00
|
|
|
void BytecodeExpectationsPrinter::PrintV8String(std::ostream* stream,
|
2018-11-27 00:48:42 +00:00
|
|
|
i::String string) const {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << '"';
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
for (int i = 0, length = string.length(); i < length; ++i) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << i::AsEscapedUC16ForJSON(string.Get(i));
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << '"';
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeExpectationsPrinter::PrintConstant(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, i::Handle<i::Object> constant) const {
|
2016-09-06 16:10:19 +00:00
|
|
|
if (constant->IsSmi()) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "Smi [";
|
|
|
|
i::Smi::cast(*constant).SmiPrint(*stream);
|
|
|
|
*stream << "]";
|
2016-09-06 16:10:19 +00:00
|
|
|
} else {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << i::HeapObject::cast(*constant).map().instance_type();
|
2016-09-06 16:10:19 +00:00
|
|
|
if (constant->IsHeapNumber()) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << " [";
|
[torque] Use generated instance types, part 1
This change begins making use of the fact that Torque now knows about
the relationship between classes and instance types, to replace a few
repetitive lists:
- Instance type checkers (single and range), defined in
src/objects/instance-type.h
- Verification dispatch in src/diagnostics/objects-debug.cc
- Printer dispatch in src/diagnostics/objects-printer.cc
- Postmortem object type detection in
tools/debug_helper/get-object-properties.cc
Torque is updated to generate four macro lists for the instance types,
representing all of the classes separated in two dimensions: classes
that correspond to a single instance type versus those that have a
range, and classes that are fully defined in Torque (with fields and
methods inside '{}') versus those that are only declared. The latter
distinction is useful because fully-defined classes are guaranteed to
correspond to real C++ classes, whereas only-declared classes are not.
A few other changes were required to make the lists above work:
- Renamed IsFiller to IsFreeSpaceOrFiller to better reflect what it does
and avoid conflicts with the new macro-generated IsFiller method. This
is the part I'm most worried about: I think the new name is an
improvement for clarity and consistency, but I could imagine someone
typing IsFiller out of habit and introducing a bug. If we'd prefer to
keep the name IsFiller, my other idea is to rename FreeSpace to
VariableSizeFiller and Filler to FixedSizeFiller.
- Made Tuple3 extend from Struct, not Tuple2, because IsTuple2 is
expected to check for only TUPLE2_TYPE and not include TUPLE3_TYPE.
- Normalized the dispatched behavior for BigIntBase and HeapNumber.
- Added a few new object printers.
Bug: v8:7793
Change-Id: I5462bb105f8a314baa59bd6ab6ab6215df6f313c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1860314
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64597}
2019-10-28 17:42:41 +00:00
|
|
|
i::HeapNumber::cast(*constant).HeapNumberShortPrint(*stream);
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "]";
|
2016-09-06 16:10:19 +00:00
|
|
|
} else if (constant->IsString()) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << " [";
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
PrintV8String(stream, i::String::cast(*constant));
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "]";
|
2016-09-06 16:10:19 +00:00
|
|
|
}
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeExpectationsPrinter::PrintFrameSize(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const {
|
2019-05-30 19:55:07 +00:00
|
|
|
int32_t frame_size = bytecode_array->frame_size();
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
|
2019-02-14 13:01:52 +00:00
|
|
|
DCHECK(IsAligned(frame_size, kSystemPointerSize));
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "frame size: " << frame_size / kSystemPointerSize
|
|
|
|
<< "\nparameter count: " << bytecode_array->parameter_count() << '\n';
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeExpectationsPrinter::PrintBytecodeSequence(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const {
|
|
|
|
*stream << "bytecode array length: " << bytecode_array->length()
|
|
|
|
<< "\nbytecodes: [\n";
|
2016-05-11 12:21:56 +00:00
|
|
|
|
|
|
|
SourcePositionTableIterator source_iterator(
|
2017-04-12 18:33:20 +00:00
|
|
|
bytecode_array->SourcePositionTable());
|
2016-05-11 12:21:56 +00:00
|
|
|
BytecodeArrayIterator bytecode_iterator(bytecode_array);
|
|
|
|
for (; !bytecode_iterator.done(); bytecode_iterator.Advance()) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << kIndent;
|
|
|
|
PrintSourcePosition(stream, &source_iterator,
|
2016-05-11 12:21:56 +00:00
|
|
|
bytecode_iterator.current_offset());
|
|
|
|
PrintBytecode(stream, bytecode_iterator, bytecode_array->parameter_count());
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << ",\n";
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "]\n";
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeExpectationsPrinter::PrintConstantPool(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, i::FixedArray constant_pool) const {
|
|
|
|
*stream << "constant pool: [\n";
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
int num_constants = constant_pool.length();
|
|
|
|
if (num_constants > 0) {
|
|
|
|
for (int i = 0; i < num_constants; ++i) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << kIndent;
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
PrintConstant(stream, i::FixedArray::get(constant_pool, i, i_isolate()));
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << ",\n";
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
}
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "]\n";
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeExpectationsPrinter::PrintCodeSnippet(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, const std::string& body) const {
|
|
|
|
*stream << "snippet: \"\n";
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
std::stringstream body_stream(body);
|
|
|
|
std::string body_line;
|
|
|
|
while (std::getline(body_stream, body_line)) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << kIndent;
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
PrintEscapedString(stream, body_line);
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << '\n';
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "\"\n";
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 12:36:26 +00:00
|
|
|
void BytecodeExpectationsPrinter::PrintHandlers(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const {
|
|
|
|
*stream << "handlers: [\n";
|
2018-02-27 09:23:48 +00:00
|
|
|
HandlerTable table(*bytecode_array);
|
|
|
|
for (int i = 0, num_entries = table.NumberOfRangeEntries(); i < num_entries;
|
2016-02-19 12:36:26 +00:00
|
|
|
++i) {
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << " [" << table.GetRangeStart(i) << ", " << table.GetRangeEnd(i)
|
|
|
|
<< ", " << table.GetRangeHandler(i) << "],\n";
|
2016-02-19 12:36:26 +00:00
|
|
|
}
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "]\n";
|
2016-02-19 12:36:26 +00:00
|
|
|
}
|
|
|
|
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
void BytecodeExpectationsPrinter::PrintBytecodeArray(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const {
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
PrintFrameSize(stream, bytecode_array);
|
|
|
|
PrintBytecodeSequence(stream, bytecode_array);
|
|
|
|
PrintConstantPool(stream, bytecode_array->constant_pool());
|
2016-02-19 12:36:26 +00:00
|
|
|
PrintHandlers(stream, bytecode_array);
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeExpectationsPrinter::PrintExpectation(
|
2019-09-10 01:19:59 +00:00
|
|
|
std::ostream* stream, const std::string& snippet) const {
|
2016-02-19 12:36:26 +00:00
|
|
|
std::string source_code =
|
|
|
|
wrap_ ? WrapCodeInFunction(test_function_name_.c_str(), snippet)
|
|
|
|
: snippet;
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
|
2018-08-10 12:41:06 +00:00
|
|
|
i::FLAG_compilation_cache = false;
|
2016-10-04 16:29:59 +00:00
|
|
|
i::Handle<i::BytecodeArray> bytecode_array;
|
2016-10-04 18:42:13 +00:00
|
|
|
if (module_) {
|
|
|
|
CHECK(top_level_ && !wrap_);
|
|
|
|
v8::Local<v8::Module> module = CompileModule(source_code.c_str());
|
|
|
|
bytecode_array = GetBytecodeArrayForModule(module);
|
2018-08-07 13:14:23 +00:00
|
|
|
} else if (print_callee_) {
|
|
|
|
bytecode_array = GetBytecodeArrayOfCallee(source_code.c_str());
|
2016-10-04 16:29:59 +00:00
|
|
|
} else {
|
2016-10-04 18:42:13 +00:00
|
|
|
v8::Local<v8::Script> script = CompileScript(source_code.c_str());
|
|
|
|
if (top_level_) {
|
|
|
|
bytecode_array = GetBytecodeArrayForScript(script);
|
|
|
|
} else {
|
|
|
|
Run(script);
|
|
|
|
bytecode_array = GetBytecodeArrayForGlobal(test_function_name_.c_str());
|
|
|
|
}
|
2016-10-04 16:29:59 +00:00
|
|
|
}
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << "---\n";
|
2016-02-19 12:36:26 +00:00
|
|
|
PrintCodeSnippet(stream, snippet);
|
|
|
|
PrintBytecodeArray(stream, bytecode_array);
|
2019-09-10 01:19:59 +00:00
|
|
|
*stream << '\n';
|
[Interpreter] Change the output format of generate-bytecode-expectations.
Now the tool produces a far more readable output format, which bears a
lot of resemblance to YAML. In fact, the output should be machine
parseable as such, one document per testcase. However, the output format
may be subject to changes in future, so don't rely on this property.
In general, the output format has been optimized for producing a meaningful
textual diff, while keeping a decent readability as well. Therefore, not
everything is as compact as it could be, e.g. for an empty const pool we get:
constant pool: [
]
instead of:
constant pool: []
Also, trailing commas are always inserted in lists.
Additionally, now the tool accepts its output format as input. When
operating in this mode, all the snippets are extracted, processed and
the output is then emitted as usual. If nothing has changed, the output
should match the input. This is very useful for catching bugs in the
bytecode generation by running a textual diff against a known-good file.
The core (namely bytecode-expectations.cc) has been extracted from the
original cc file, which provides the utility as usual. The definitions
in the matching header of the library have been moved into the
v8::internal::interpreter namespace.
The library exposes a class ExpectationPrinter, with a method
PrintExpectation, which takes a test snippet as input, and writes the
formatted expectation to the supplied stream. One might then use a
std::stringstream to retrieve the results as a string and run it through
a diff utility.
BUG=v8:4280
LOG=N
Review URL: https://codereview.chromium.org/1688383003
Cr-Commit-Position: refs/heads/master@{#33997}
2016-02-15 15:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace interpreter
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|