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

Unified Diff: test/cctest/test-serialize.cc

Issue 982773003: Serializer: simplify external reference encoding. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/serialize.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-serialize.cc
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
index 21a27f534e0a5d457291de34a4d5f90ffd3180be..e4acd00167e8d46b9def005f472b00f5d75579a3 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -65,74 +65,6 @@ class TestIsolate : public Isolate {
};
-template <class T>
-static Address AddressOf(T id) {
- return ExternalReference(id, CcTest::i_isolate()).address();
-}
-
-
-template <class T>
-static uint32_t Encode(const ExternalReferenceEncoder& encoder, T id) {
- return encoder.Encode(AddressOf(id));
-}
-
-
-static uint32_t make_code(TypeCode type, int id) {
- return static_cast<uint32_t>(type) << kReferenceTypeShift | id;
-}
-
-
-TEST(ExternalReferenceEncoder) {
- Isolate* isolate = CcTest::i_isolate();
- v8::V8::Initialize();
-
- ExternalReferenceEncoder encoder(isolate);
- CHECK_EQ(make_code(BUILTIN, Builtins::kArrayCode),
- Encode(encoder, Builtins::kArrayCode));
- CHECK_EQ(make_code(v8::internal::RUNTIME_FUNCTION, Runtime::kAbort),
- Encode(encoder, Runtime::kAbort));
- ExternalReference stack_limit_address =
- ExternalReference::address_of_stack_limit(isolate);
- CHECK_EQ(make_code(UNCLASSIFIED, 2),
- encoder.Encode(stack_limit_address.address()));
- ExternalReference real_stack_limit_address =
- ExternalReference::address_of_real_stack_limit(isolate);
- CHECK_EQ(make_code(UNCLASSIFIED, 3),
- encoder.Encode(real_stack_limit_address.address()));
- CHECK_EQ(make_code(UNCLASSIFIED, 8),
- encoder.Encode(ExternalReference::debug_break(isolate).address()));
- CHECK_EQ(
- make_code(UNCLASSIFIED, 4),
- encoder.Encode(ExternalReference::new_space_start(isolate).address()));
- CHECK_EQ(
- make_code(UNCLASSIFIED, 1),
- encoder.Encode(ExternalReference::roots_array_start(isolate).address()));
- CHECK_EQ(make_code(UNCLASSIFIED, 33),
- encoder.Encode(ExternalReference::cpu_features().address()));
-}
-
-
-TEST(ExternalReferenceDecoder) {
- Isolate* isolate = CcTest::i_isolate();
- v8::V8::Initialize();
-
- ExternalReferenceDecoder decoder(isolate);
- CHECK_EQ(AddressOf(Builtins::kArrayCode),
- decoder.Decode(make_code(BUILTIN, Builtins::kArrayCode)));
- CHECK_EQ(AddressOf(Runtime::kAbort),
- decoder.Decode(make_code(v8::internal::RUNTIME_FUNCTION,
- Runtime::kAbort)));
- CHECK_EQ(ExternalReference::address_of_stack_limit(isolate).address(),
- decoder.Decode(make_code(UNCLASSIFIED, 2)));
- CHECK_EQ(ExternalReference::address_of_real_stack_limit(isolate).address(),
- decoder.Decode(make_code(UNCLASSIFIED, 3)));
- CHECK_EQ(ExternalReference::debug_break(isolate).address(),
- decoder.Decode(make_code(UNCLASSIFIED, 8)));
- CHECK_EQ(ExternalReference::new_space_start(isolate).address(),
- decoder.Decode(make_code(UNCLASSIFIED, 4)));
-}
-
-
void WritePayload(const Vector<const byte>& payload, const char* file_name) {
FILE* file = v8::base::OS::FOpen(file_name, "wb");
if (file == NULL) {
« no previous file with comments | « src/serialize.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698