| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #include "debug.h" | 32 #include "debug.h" |
| 33 #include "disasm.h" | 33 #include "disasm.h" |
| 34 #include "disassembler.h" | 34 #include "disassembler.h" |
| 35 #include "macro-assembler.h" | 35 #include "macro-assembler.h" |
| 36 #include "serialize.h" | 36 #include "serialize.h" |
| 37 #include "cctest.h" | 37 #include "cctest.h" |
| 38 | 38 |
| 39 using namespace v8::internal; | 39 using namespace v8::internal; |
| 40 | 40 |
| 41 static v8::Persistent<v8::Context> env; | |
| 42 | |
| 43 static void InitializeVM() { | |
| 44 if (env.IsEmpty()) { | |
| 45 env = v8::Context::New(); | |
| 46 } | |
| 47 } | |
| 48 | |
| 49 | 41 |
| 50 #define __ assm. | 42 #define __ assm. |
| 51 | 43 |
| 52 | 44 |
| 53 static void DummyStaticFunction(Object* result) { | 45 static void DummyStaticFunction(Object* result) { |
| 54 } | 46 } |
| 55 | 47 |
| 56 | 48 |
| 57 TEST(DisasmIa320) { | 49 TEST(DisasmIa320) { |
| 58 InitializeVM(); | 50 CcTest::InitializeVM(); |
| 59 Isolate* isolate = reinterpret_cast<Isolate*>(env->GetIsolate()); | 51 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); |
| 60 HandleScope scope(isolate); | 52 HandleScope scope(isolate); |
| 61 v8::internal::byte buffer[2048]; | 53 v8::internal::byte buffer[2048]; |
| 62 Assembler assm(isolate, buffer, sizeof buffer); | 54 Assembler assm(isolate, buffer, sizeof buffer); |
| 63 DummyStaticFunction(NULL); // just bloody use it (DELETE; debugging) | 55 DummyStaticFunction(NULL); // just bloody use it (DELETE; debugging) |
| 64 | 56 |
| 65 // Short immediate instructions | 57 // Short immediate instructions |
| 66 __ adc(eax, 12345678); | 58 __ adc(eax, 12345678); |
| 67 __ add(eax, Immediate(12345678)); | 59 __ add(eax, Immediate(12345678)); |
| 68 __ or_(eax, 12345678); | 60 __ or_(eax, 12345678); |
| 69 __ sub(eax, Immediate(12345678)); | 61 __ sub(eax, Immediate(12345678)); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 CHECK(code->IsCode()); | 457 CHECK(code->IsCode()); |
| 466 #ifdef OBJECT_PRINT | 458 #ifdef OBJECT_PRINT |
| 467 Code::cast(code)->Print(); | 459 Code::cast(code)->Print(); |
| 468 byte* begin = Code::cast(code)->instruction_start(); | 460 byte* begin = Code::cast(code)->instruction_start(); |
| 469 byte* end = begin + Code::cast(code)->instruction_size(); | 461 byte* end = begin + Code::cast(code)->instruction_size(); |
| 470 disasm::Disassembler::Disassemble(stdout, begin, end); | 462 disasm::Disassembler::Disassemble(stdout, begin, end); |
| 471 #endif | 463 #endif |
| 472 } | 464 } |
| 473 | 465 |
| 474 #undef __ | 466 #undef __ |
| OLD | NEW |