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

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

Issue 66553004: Revert "Add signed/unsigned 8-bit and 16-bit Representations to Crankshaft" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « test/cctest/test-macro-assembler-arm.cc ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #include <stdlib.h>
29
30 #include "v8.h"
31
32 #include "macro-assembler.h"
33 #include "factory.h"
34 #include "platform.h"
35 #include "serialize.h"
36 #include "cctest.h"
37
38 using namespace v8::internal;
39
40 #if __GNUC__
41 #define STDCALL __attribute__((stdcall))
42 #else
43 #define STDCALL __stdcall
44 #endif
45
46 typedef int STDCALL F0Type();
47 typedef F0Type* F0;
48
49 #define __ masm->
50
51
52 TEST(LoadAndStoreWithRepresentation) {
53 v8::internal::V8::Initialize(NULL);
54
55 // Allocate an executable page of memory.
56 size_t actual_size;
57 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
58 &actual_size,
59 true));
60 CHECK(buffer);
61 Isolate* isolate = CcTest::i_isolate();
62 HandleScope handles(isolate);
63 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
64 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
65 masm->set_allow_stub_calls(false);
66 __ push(ebx);
67 __ push(edx);
68 __ sub(esp, Immediate(1 * kPointerSize));
69 Label exit;
70
71 // Test 1.
72 __ mov(eax, Immediate(1)); // Test number.
73 __ mov(Operand(esp, 0 * kPointerSize), Immediate(0));
74 __ mov(ebx, Immediate(-1));
75 __ Store(ebx, Operand(esp, 0 * kPointerSize), Representation::UInteger8());
76 __ mov(ebx, Operand(esp, 0 * kPointerSize));
77 __ mov(edx, Immediate(255));
78 __ cmp(ebx, edx);
79 __ j(not_equal, &exit);
80 __ Load(ebx, Operand(esp, 0 * kPointerSize), Representation::UInteger8());
81 __ cmp(ebx, edx);
82 __ j(not_equal, &exit);
83
84
85 // Test 2.
86 __ mov(eax, Immediate(2)); // Test number.
87 __ mov(Operand(esp, 0 * kPointerSize), Immediate(0));
88 __ mov(ebx, Immediate(-1));
89 __ Store(ebx, Operand(esp, 0 * kPointerSize), Representation::Integer8());
90 __ mov(ebx, Operand(esp, 0 * kPointerSize));
91 __ mov(edx, Immediate(255));
92 __ cmp(ebx, edx);
93 __ j(not_equal, &exit);
94 __ Load(ebx, Operand(esp, 0 * kPointerSize), Representation::Integer8());
95 __ mov(edx, Immediate(-1));
96 __ cmp(ebx, edx);
97 __ j(not_equal, &exit);
98
99 // Test 3.
100 __ mov(eax, Immediate(3)); // Test number.
101 __ mov(Operand(esp, 0 * kPointerSize), Immediate(0));
102 __ mov(ebx, Immediate(-1));
103 __ Store(ebx, Operand(esp, 0 * kPointerSize), Representation::Integer16());
104 __ mov(ebx, Operand(esp, 0 * kPointerSize));
105 __ mov(edx, Immediate(65535));
106 __ cmp(ebx, edx);
107 __ j(not_equal, &exit);
108 __ Load(edx, Operand(esp, 0 * kPointerSize), Representation::Integer16());
109 __ mov(ebx, Immediate(-1));
110 __ cmp(ebx, edx);
111 __ j(not_equal, &exit);
112
113 // Test 4.
114 __ mov(eax, Immediate(4)); // Test number.
115 __ mov(Operand(esp, 0 * kPointerSize), Immediate(0));
116 __ mov(ebx, Immediate(-1));
117 __ Store(ebx, Operand(esp, 0 * kPointerSize), Representation::UInteger16());
118 __ mov(ebx, Operand(esp, 0 * kPointerSize));
119 __ mov(edx, Immediate(65535));
120 __ cmp(ebx, edx);
121 __ j(not_equal, &exit);
122 __ Load(edx, Operand(esp, 0 * kPointerSize), Representation::UInteger16());
123 __ cmp(ebx, edx);
124 __ j(not_equal, &exit);
125
126 __ xor_(eax, eax); // Success.
127 __ bind(&exit);
128 __ add(esp, Immediate(1 * kPointerSize));
129 __ pop(edx);
130 __ pop(ebx);
131 __ ret(0);
132
133 CodeDesc desc;
134 masm->GetCode(&desc);
135 // Call the function from C++.
136 int result = FUNCTION_CAST<F0>(buffer)();
137 CHECK_EQ(0, result);
138 }
139
140 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-macro-assembler-arm.cc ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698