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

Unified Diff: test/cctest/test-macro-assembler-mips64.cc

Issue 2028633002: Provide a tagged allocation top pointer. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP: adding a few tests. Created 4 years, 6 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 | « test/cctest/test-macro-assembler-mips.cc ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-macro-assembler-mips64.cc
diff --git a/test/cctest/test-macro-assembler-mips64.cc b/test/cctest/test-macro-assembler-mips64.cc
index f0180c18e336acfd865c38339d9ca5f626152ed1..cad341d0231337941c2c388cd6add5dfeaa5eb43 100644
--- a/test/cctest/test-macro-assembler-mips64.cc
+++ b/test/cctest/test-macro-assembler-mips64.cc
@@ -30,6 +30,7 @@
#include "src/v8.h"
#include "test/cctest/cctest.h"
+#include "test/cctest/heap/heap-utils.h"
#include "src/base/utils/random-number-generator.h"
#include "src/macro-assembler.h"
@@ -1745,4 +1746,68 @@ TEST(Uldc1) {
}
}
+template <typename Fun>
+void AssembleFunction(Isolate* isolate, size_t actual_size, byte* buffer,
+ Fun f) {
+ MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size),
+ v8::internal::CodeObjectRequired::kYes);
+ MacroAssembler* masm = &assembler;
+ f(masm);
+ __ jr(ra);
+
+ CodeDesc desc;
+ masm->GetCode(&desc);
+}
+
+TEST(AllocateMacrosNoGCRequired) {
+ typedef intptr_t (*F0)();
+ // Allocate an executable page of memory.
+ CcTest::InitializeVM();
+ size_t actual_size;
+ byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
+ Assembler::kMinimalBufferSize, &actual_size, true));
+ CHECK(buffer);
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope handles(isolate);
+
+ AllocationFlags const kNoAllocationFlags =
+ static_cast<AllocationFlags>(NO_ALLOCATION_FLAGS);
+
+#define CHECK_TAGGED(result) CHECK_EQ(result& kHeapObjectTag, 1);
+
+ heap::GcAndSweep(isolate->heap(), AllocationSpace::NEW_SPACE);
+ {
+ AssembleFunction(isolate, actual_size, buffer, [](MacroAssembler* masm) {
+ Label gc_required, success;
+ __ Allocate(kPointerSize, v0, t0, t1, &gc_required, kNoAllocationFlags);
+ __ jmp(&success);
+ __ bind(&gc_required);
+ __ Abort(kNoReason);
+ __ bind(&success);
+ });
+ F0 f = FUNCTION_CAST<F0>(buffer);
+ intptr_t test_result = reinterpret_cast<intptr_t>(
+ CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0));
+ CHECK_TAGGED(test_result);
+ }
+
+ {
+ AssembleFunction(isolate, actual_size, buffer, [](MacroAssembler* masm) {
+ Label gc_required, success;
+ __ li(a0, Operand(kPointerSize));
+ __ Allocate(a0, v0, t0, t1, &gc_required, kNoAllocationFlags);
+ __ jmp(&success);
+ __ bind(&gc_required);
+ __ Abort(kNoReason);
+ __ bind(&success);
+ });
+ F0 f = FUNCTION_CAST<F0>(buffer);
+ intptr_t test_result = reinterpret_cast<intptr_t>(
+ CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0));
+ CHECK_TAGGED(test_result);
+ }
+
+#undef CHECK_TAGGED
+}
+
#undef __
« no previous file with comments | « test/cctest/test-macro-assembler-mips.cc ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698