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

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

Issue 6577036: [Isolates] Merge from bleeding_edge to isolates, revisions 6100-6300. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/cctest.status ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 __ add(eax, Operand(esp, 8)); 67 __ add(eax, Operand(esp, 8));
68 __ ret(0); 68 __ ret(0);
69 69
70 CodeDesc desc; 70 CodeDesc desc;
71 assm.GetCode(&desc); 71 assm.GetCode(&desc);
72 Object* code = HEAP->CreateCode( 72 Object* code = HEAP->CreateCode(
73 desc, 73 desc,
74 Code::ComputeFlags(Code::STUB), 74 Code::ComputeFlags(Code::STUB),
75 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); 75 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
76 CHECK(code->IsCode()); 76 CHECK(code->IsCode());
77 #ifdef DEBUG 77 #ifdef OBJECT_PRINT
78 Code::cast(code)->Print(); 78 Code::cast(code)->Print();
79 #endif 79 #endif
80 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); 80 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry());
81 int res = f(3, 4); 81 int res = f(3, 4);
82 ::printf("f() = %d\n", res); 82 ::printf("f() = %d\n", res);
83 CHECK_EQ(7, res); 83 CHECK_EQ(7, res);
84 } 84 }
85 85
86 86
87 TEST(AssemblerIa321) { 87 TEST(AssemblerIa321) {
(...skipping 17 matching lines...) Expand all
105 __ j(not_zero, &L, taken); 105 __ j(not_zero, &L, taken);
106 __ ret(0); 106 __ ret(0);
107 107
108 CodeDesc desc; 108 CodeDesc desc;
109 assm.GetCode(&desc); 109 assm.GetCode(&desc);
110 Object* code = HEAP->CreateCode( 110 Object* code = HEAP->CreateCode(
111 desc, 111 desc,
112 Code::ComputeFlags(Code::STUB), 112 Code::ComputeFlags(Code::STUB),
113 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); 113 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
114 CHECK(code->IsCode()); 114 CHECK(code->IsCode());
115 #ifdef DEBUG 115 #ifdef OBJECT_PRINT
116 Code::cast(code)->Print(); 116 Code::cast(code)->Print();
117 #endif 117 #endif
118 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); 118 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry());
119 int res = f(100); 119 int res = f(100);
120 ::printf("f() = %d\n", res); 120 ::printf("f() = %d\n", res);
121 CHECK_EQ(5050, res); 121 CHECK_EQ(5050, res);
122 } 122 }
123 123
124 124
125 TEST(AssemblerIa322) { 125 TEST(AssemblerIa322) {
(...skipping 21 matching lines...) Expand all
147 __ mov(eax, FACTORY->true_value()); 147 __ mov(eax, FACTORY->true_value());
148 __ jmp(NULL, RelocInfo::RUNTIME_ENTRY); 148 __ jmp(NULL, RelocInfo::RUNTIME_ENTRY);
149 149
150 CodeDesc desc; 150 CodeDesc desc;
151 assm.GetCode(&desc); 151 assm.GetCode(&desc);
152 Object* code = HEAP->CreateCode( 152 Object* code = HEAP->CreateCode(
153 desc, 153 desc,
154 Code::ComputeFlags(Code::STUB), 154 Code::ComputeFlags(Code::STUB),
155 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); 155 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
156 CHECK(code->IsCode()); 156 CHECK(code->IsCode());
157 #ifdef DEBUG 157 #ifdef OBJECT_PRINT
158 Code::cast(code)->Print(); 158 Code::cast(code)->Print();
159 #endif 159 #endif
160 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); 160 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry());
161 int res = f(10); 161 int res = f(10);
162 ::printf("f() = %d\n", res); 162 ::printf("f() = %d\n", res);
163 CHECK_EQ(3628800, res); 163 CHECK_EQ(3628800, res);
164 } 164 }
165 165
166 166
167 typedef int (*F3)(float x); 167 typedef int (*F3)(float x);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 __ fld_d(Operand(esp, 0)); 321 __ fld_d(Operand(esp, 0));
322 __ add(Operand(esp), Immediate(8)); 322 __ add(Operand(esp), Immediate(8));
323 __ ret(0); 323 __ ret(0);
324 CodeDesc desc; 324 CodeDesc desc;
325 assm.GetCode(&desc); 325 assm.GetCode(&desc);
326 Code* code = Code::cast(HEAP->CreateCode( 326 Code* code = Code::cast(HEAP->CreateCode(
327 desc, 327 desc,
328 Code::ComputeFlags(Code::STUB), 328 Code::ComputeFlags(Code::STUB),
329 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked()); 329 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked());
330 CHECK(code->IsCode()); 330 CHECK(code->IsCode());
331 #ifdef DEBUG 331 #ifdef OBJECT_PRINT
332 Code::cast(code)->Print(); 332 Code::cast(code)->Print();
333 #endif 333 #endif
334 F6 f = FUNCTION_CAST<F6>(Code::cast(code)->entry()); 334 F6 f = FUNCTION_CAST<F6>(Code::cast(code)->entry());
335 double res = f(12); 335 double res = f(12);
336 336
337 ::printf("f() = %f\n", res); 337 ::printf("f() = %f\n", res);
338 CHECK(11.99 < res && res < 12.001); 338 CHECK(11.99 < res && res < 12.001);
339 } 339 }
340 340
341 341
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 __ ret(0); 376 __ ret(0);
377 377
378 378
379 CodeDesc desc; 379 CodeDesc desc;
380 assm.GetCode(&desc); 380 assm.GetCode(&desc);
381 Code* code = Code::cast(HEAP->CreateCode( 381 Code* code = Code::cast(HEAP->CreateCode(
382 desc, 382 desc,
383 Code::ComputeFlags(Code::STUB), 383 Code::ComputeFlags(Code::STUB),
384 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked()); 384 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked());
385 CHECK(code->IsCode()); 385 CHECK(code->IsCode());
386 #ifdef DEBUG 386 #ifdef OBJECT_PRINT
387 Code::cast(code)->Print(); 387 Code::cast(code)->Print();
388 #endif 388 #endif
389 389
390 F7 f = FUNCTION_CAST<F7>(Code::cast(code)->entry()); 390 F7 f = FUNCTION_CAST<F7>(Code::cast(code)->entry());
391 CHECK_EQ(kLess, f(1.1, 2.2)); 391 CHECK_EQ(kLess, f(1.1, 2.2));
392 CHECK_EQ(kEqual, f(2.2, 2.2)); 392 CHECK_EQ(kEqual, f(2.2, 2.2));
393 CHECK_EQ(kGreater, f(3.3, 2.2)); 393 CHECK_EQ(kGreater, f(3.3, 2.2));
394 CHECK_EQ(kNaN, f(OS::nan_value(), 1.1)); 394 CHECK_EQ(kNaN, f(OS::nan_value(), 1.1));
395 } 395 }
396 396
397 #undef __ 397 #undef __
OLDNEW
« no previous file with comments | « test/cctest/cctest.status ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698