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

Side by Side Diff: test/cctest/test-macro-assembler-arm.cc

Issue 358363002: Move platform abstraction to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 TEST(CopyBytes) { 62 TEST(CopyBytes) {
63 CcTest::InitializeVM(); 63 CcTest::InitializeVM();
64 Isolate* isolate = Isolate::Current(); 64 Isolate* isolate = Isolate::Current();
65 HandleScope handles(isolate); 65 HandleScope handles(isolate);
66 66
67 const int data_size = 1 * KB; 67 const int data_size = 1 * KB;
68 size_t act_size; 68 size_t act_size;
69 69
70 // Allocate two blocks to copy data between. 70 // Allocate two blocks to copy data between.
71 byte* src_buffer = static_cast<byte*>(OS::Allocate(data_size, &act_size, 0)); 71 byte* src_buffer =
72 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0));
72 CHECK(src_buffer); 73 CHECK(src_buffer);
73 CHECK(act_size >= static_cast<size_t>(data_size)); 74 CHECK(act_size >= static_cast<size_t>(data_size));
74 byte* dest_buffer = static_cast<byte*>(OS::Allocate(data_size, &act_size, 0)); 75 byte* dest_buffer =
76 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0));
75 CHECK(dest_buffer); 77 CHECK(dest_buffer);
76 CHECK(act_size >= static_cast<size_t>(data_size)); 78 CHECK(act_size >= static_cast<size_t>(data_size));
77 79
78 // Storage for R0 and R1. 80 // Storage for R0 and R1.
79 byte* r0_; 81 byte* r0_;
80 byte* r1_; 82 byte* r1_;
81 83
82 MacroAssembler assembler(isolate, NULL, 0); 84 MacroAssembler assembler(isolate, NULL, 0);
83 MacroAssembler* masm = &assembler; 85 MacroAssembler* masm = &assembler;
84 86
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 134
133 135
134 typedef int (*F5)(void*, void*, void*, void*, void*); 136 typedef int (*F5)(void*, void*, void*, void*, void*);
135 137
136 138
137 TEST(LoadAndStoreWithRepresentation) { 139 TEST(LoadAndStoreWithRepresentation) {
138 v8::internal::V8::Initialize(NULL); 140 v8::internal::V8::Initialize(NULL);
139 141
140 // Allocate an executable page of memory. 142 // Allocate an executable page of memory.
141 size_t actual_size; 143 size_t actual_size;
142 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 144 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
143 &actual_size, 145 Assembler::kMinimalBufferSize, &actual_size, true));
144 true));
145 CHECK(buffer); 146 CHECK(buffer);
146 Isolate* isolate = CcTest::i_isolate(); 147 Isolate* isolate = CcTest::i_isolate();
147 HandleScope handles(isolate); 148 HandleScope handles(isolate);
148 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 149 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
149 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. 150 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
150 __ sub(sp, sp, Operand(1 * kPointerSize)); 151 __ sub(sp, sp, Operand(1 * kPointerSize));
151 Label exit; 152 Label exit;
152 153
153 // Test 1. 154 // Test 1.
154 __ mov(r0, Operand(1)); // Test number. 155 __ mov(r0, Operand(1)); // Test number.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 masm->GetCode(&desc); 220 masm->GetCode(&desc);
220 Handle<Code> code = isolate->factory()->NewCode( 221 Handle<Code> code = isolate->factory()->NewCode(
221 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 222 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
222 223
223 // Call the function from C++. 224 // Call the function from C++.
224 F5 f = FUNCTION_CAST<F5>(code->entry()); 225 F5 f = FUNCTION_CAST<F5>(code->entry());
225 CHECK_EQ(0, CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0)); 226 CHECK_EQ(0, CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0));
226 } 227 }
227 228
228 #undef __ 229 #undef __
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698