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

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

Issue 23641009: Refactor and cleanup VirtualMemory. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed nits. Created 7 years, 3 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-code-stubs-x64.cc ('k') | test/cctest/test-platform-linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-macro-assembler-x64.cc
diff --git a/test/cctest/test-macro-assembler-x64.cc b/test/cctest/test-macro-assembler-x64.cc
index a2070a5ea8fa7cfe99dc1689e0415de6b5bee00e..4973ef53cf4d2538f049139564f09061067da794 100644
--- a/test/cctest/test-macro-assembler-x64.cc
+++ b/test/cctest/test-macro-assembler-x64.cc
@@ -35,49 +35,7 @@
#include "serialize.h"
#include "cctest.h"
-using v8::internal::Assembler;
-using v8::internal::CodeDesc;
-using v8::internal::Condition;
-using v8::internal::FUNCTION_CAST;
-using v8::internal::HandleScope;
-using v8::internal::Immediate;
-using v8::internal::Isolate;
-using v8::internal::Label;
-using v8::internal::MacroAssembler;
-using v8::internal::OS;
-using v8::internal::Operand;
-using v8::internal::RelocInfo;
-using v8::internal::Smi;
-using v8::internal::SmiIndex;
-using v8::internal::byte;
-using v8::internal::carry;
-using v8::internal::greater;
-using v8::internal::greater_equal;
-using v8::internal::kIntSize;
-using v8::internal::kPointerSize;
-using v8::internal::kSmiTagMask;
-using v8::internal::kSmiValueSize;
-using v8::internal::less_equal;
-using v8::internal::negative;
-using v8::internal::not_carry;
-using v8::internal::not_equal;
-using v8::internal::not_zero;
-using v8::internal::positive;
-using v8::internal::r11;
-using v8::internal::r13;
-using v8::internal::r14;
-using v8::internal::r15;
-using v8::internal::r8;
-using v8::internal::r9;
-using v8::internal::rax;
-using v8::internal::rbp;
-using v8::internal::rbx;
-using v8::internal::rcx;
-using v8::internal::rdi;
-using v8::internal::rdx;
-using v8::internal::rsi;
-using v8::internal::rsp;
-using v8::internal::times_pointer_size;
+using namespace v8::internal;
// Test the x64 assembler by compiling some simple functions into
// a buffer and executing them. These tests do not initialize the
@@ -153,9 +111,10 @@ TEST(SmiMove) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -241,10 +200,10 @@ TEST(SmiCompare) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize * 2,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -293,9 +252,10 @@ TEST(Integer32ToSmi) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -422,9 +382,10 @@ TEST(Integer64PlusConstantToSmi) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -467,9 +428,10 @@ TEST(SmiCheck) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -715,10 +677,10 @@ TEST(SmiNeg) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -806,9 +768,10 @@ TEST(SmiAdd) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -996,10 +959,10 @@ TEST(SmiSub) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize * 2,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -1088,9 +1051,10 @@ TEST(SmiMul) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -1194,10 +1158,10 @@ TEST(SmiDiv) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize * 2,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -1305,10 +1269,10 @@ TEST(SmiMod) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize * 2,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -1403,10 +1367,10 @@ TEST(SmiIndex) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize * 3,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -1473,10 +1437,10 @@ TEST(SmiSelectNonSmi) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -1553,10 +1517,10 @@ TEST(SmiAnd) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -1635,10 +1599,10 @@ TEST(SmiOr) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -1719,10 +1683,10 @@ TEST(SmiXor) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -1787,10 +1751,10 @@ TEST(SmiNot) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -1884,10 +1848,10 @@ TEST(SmiShiftLeft) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize * 4,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -1991,10 +1955,10 @@ TEST(SmiShiftLogicalRight) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize * 3,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -2061,10 +2025,10 @@ TEST(SmiShiftArithmeticRight) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize * 2,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -2126,10 +2090,10 @@ TEST(PositiveSmiTimesPowerOfTwoToInteger64) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize * 4,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
@@ -2170,10 +2134,10 @@ TEST(OperandOffset) {
// Allocate an executable page of memory.
size_t actual_size;
- byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
- &actual_size,
- true));
+ byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion(
+ Assembler::kMinimalBufferSize * 2,
+ &actual_size,
+ VirtualMemory::EXECUTABLE));
CHECK(buffer);
Isolate* isolate = Isolate::Current();
HandleScope handles(isolate);
« no previous file with comments | « test/cctest/test-code-stubs-x64.cc ('k') | test/cctest/test-platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698