Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 __ j(not_equal, &target); | 369 __ j(not_equal, &target); |
| 370 __ bind(&target); | 370 __ bind(&target); |
| 371 __ nop(); | 371 __ nop(); |
| 372 } | 372 } |
| 373 | 373 |
| 374 | 374 |
| 375 TEST(AssemblerMultiByteNop) { | 375 TEST(AssemblerMultiByteNop) { |
| 376 InitializeVM(); | 376 InitializeVM(); |
| 377 v8::HandleScope scope; | 377 v8::HandleScope scope; |
| 378 v8::internal::byte buffer[1024]; | 378 v8::internal::byte buffer[1024]; |
| 379 Assembler assm(Isolate::Current(), buffer, sizeof(buffer)); | 379 Isolate* isolate = Isolate::Current(); |
| 380 Assembler assm(isolate, buffer, sizeof(buffer)); | |
| 380 __ push(rbx); | 381 __ push(rbx); |
| 381 __ push(rcx); | 382 __ push(rcx); |
| 382 __ push(rdx); | 383 __ push(rdx); |
| 383 __ push(rdi); | 384 __ push(rdi); |
| 384 __ push(rsi); | 385 __ push(rsi); |
| 385 __ movq(rax, Immediate(1)); | 386 __ movq(rax, Immediate(1)); |
| 386 __ movq(rbx, Immediate(2)); | 387 __ movq(rbx, Immediate(2)); |
| 387 __ movq(rcx, Immediate(3)); | 388 __ movq(rcx, Immediate(3)); |
| 388 __ movq(rdx, Immediate(4)); | 389 __ movq(rdx, Immediate(4)); |
| 389 __ movq(rdi, Immediate(5)); | 390 __ movq(rdi, Immediate(5)); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 418 __ movq(rax, Immediate(13)); | 419 __ movq(rax, Immediate(13)); |
| 419 __ pop(rsi); | 420 __ pop(rsi); |
| 420 __ pop(rdi); | 421 __ pop(rdi); |
| 421 __ pop(rdx); | 422 __ pop(rdx); |
| 422 __ pop(rcx); | 423 __ pop(rcx); |
| 423 __ pop(rbx); | 424 __ pop(rbx); |
| 424 __ ret(0); | 425 __ ret(0); |
| 425 | 426 |
| 426 CodeDesc desc; | 427 CodeDesc desc; |
| 427 assm.GetCode(&desc); | 428 assm.GetCode(&desc); |
| 428 Code* code = Code::cast(HEAP->CreateCode( | 429 Code* code = Code::cast(isolate->heap()->CreateCode( |
| 429 desc, | 430 desc, |
| 430 Code::ComputeFlags(Code::STUB), | 431 Code::ComputeFlags(Code::STUB), |
| 431 v8::internal::Handle<v8::internal::Object>( | 432 v8::internal::Handle<v8::internal::Object>( |
| 432 HEAP->undefined_value()))->ToObjectChecked()); | 433 isolate->heap()->undefined_value(), isolate))->ToObjectChecked()); |
|
Michael Starzinger
2013/02/25 10:50:58
Just use "isolate->factory()->undefined_value()" h
Sven Panne
2013/02/25 14:44:43
Done.
| |
| 433 CHECK(code->IsCode()); | 434 CHECK(code->IsCode()); |
| 434 | 435 |
| 435 F0 f = FUNCTION_CAST<F0>(code->entry()); | 436 F0 f = FUNCTION_CAST<F0>(code->entry()); |
| 436 int res = f(); | 437 int res = f(); |
| 437 CHECK_EQ(42, res); | 438 CHECK_EQ(42, res); |
| 438 } | 439 } |
| 439 | 440 |
| 440 | 441 |
| 441 | 442 |
| 442 | 443 |
| 443 #undef __ | 444 #undef __ |
| OLD | NEW |