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

Side by Side Diff: src/x64/assembler-x64.cc

Issue 196077: X64: Extract all smi operations into MacroAssembler macros. (Closed)
Patch Set: Created 11 years, 3 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
OLDNEW
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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 L->bind_to(pos); 355 L->bind_to(pos);
356 } 356 }
357 357
358 358
359 void Assembler::bind(Label* L) { 359 void Assembler::bind(Label* L) {
360 bind_to(L, pc_offset()); 360 bind_to(L, pc_offset());
361 } 361 }
362 362
363 363
364 void Assembler::GrowBuffer() { 364 void Assembler::GrowBuffer() {
365 ASSERT(overflow()); // should not call this otherwise 365 ASSERT(buffer_overflow()); // should not call this otherwise
366 if (!own_buffer_) FATAL("external code buffer is too small"); 366 if (!own_buffer_) FATAL("external code buffer is too small");
367 367
368 // compute new buffer size 368 // compute new buffer size
369 CodeDesc desc; // the new buffer 369 CodeDesc desc; // the new buffer
370 if (buffer_size_ < 4*KB) { 370 if (buffer_size_ < 4*KB) {
371 desc.buffer_size = 4*KB; 371 desc.buffer_size = 4*KB;
372 } else { 372 } else {
373 desc.buffer_size = 2*buffer_size_; 373 desc.buffer_size = 2*buffer_size_;
374 } 374 }
375 // Some internal data structures overflow for very large buffers, 375 // Some internal data structures overflow for very large buffers,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 for (RelocIterator it(desc); !it.done(); it.next()) { 417 for (RelocIterator it(desc); !it.done(); it.next()) {
418 RelocInfo::Mode rmode = it.rinfo()->rmode(); 418 RelocInfo::Mode rmode = it.rinfo()->rmode();
419 if (rmode == RelocInfo::INTERNAL_REFERENCE) { 419 if (rmode == RelocInfo::INTERNAL_REFERENCE) {
420 intptr_t* p = reinterpret_cast<intptr_t*>(it.rinfo()->pc()); 420 intptr_t* p = reinterpret_cast<intptr_t*>(it.rinfo()->pc());
421 if (*p != 0) { // 0 means uninitialized. 421 if (*p != 0) { // 0 means uninitialized.
422 *p += pc_delta; 422 *p += pc_delta;
423 } 423 }
424 } 424 }
425 } 425 }
426 426
427 ASSERT(!overflow()); 427 ASSERT(!buffer_overflow());
428 } 428 }
429 429
430 430
431 void Assembler::emit_operand(int code, const Operand& adr) { 431 void Assembler::emit_operand(int code, const Operand& adr) {
432 ASSERT(is_uint3(code)); 432 ASSERT(is_uint3(code));
433 const unsigned length = adr.len_; 433 const unsigned length = adr.len_;
434 ASSERT(length > 0); 434 ASSERT(length > 0);
435 435
436 // Emit updated ModR/M byte containing the given register. 436 // Emit updated ModR/M byte containing the given register.
437 ASSERT((adr.buf_[0] & 0x38) == 0); 437 ASSERT((adr.buf_[0] & 0x38) == 0);
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 1399
1400 void Assembler::neg(Register dst) { 1400 void Assembler::neg(Register dst) {
1401 EnsureSpace ensure_space(this); 1401 EnsureSpace ensure_space(this);
1402 last_pc_ = pc_; 1402 last_pc_ = pc_;
1403 emit_rex_64(dst); 1403 emit_rex_64(dst);
1404 emit(0xF7); 1404 emit(0xF7);
1405 emit_modrm(0x3, dst); 1405 emit_modrm(0x3, dst);
1406 } 1406 }
1407 1407
1408 1408
1409 void Assembler::negl(Register dst) {
1410 EnsureSpace ensure_space(this);
1411 last_pc_ = pc_;
1412 emit_optional_rex_32(dst);
1413 emit(0xF7);
1414 emit_modrm(0x3, dst);
1415 }
1416
1417
1409 void Assembler::neg(const Operand& dst) { 1418 void Assembler::neg(const Operand& dst) {
1410 EnsureSpace ensure_space(this); 1419 EnsureSpace ensure_space(this);
1411 last_pc_ = pc_; 1420 last_pc_ = pc_;
1412 emit_rex_64(dst); 1421 emit_rex_64(dst);
1413 emit(0xF7); 1422 emit(0xF7);
1414 emit_operand(3, dst); 1423 emit_operand(3, dst);
1415 } 1424 }
1416 1425
1417 1426
1418 void Assembler::nop() { 1427 void Assembler::nop() {
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 RecordRelocInfo(RelocInfo::POSITION, current_position_); 2367 RecordRelocInfo(RelocInfo::POSITION, current_position_);
2359 written_position_ = current_position_; 2368 written_position_ = current_position_;
2360 } 2369 }
2361 } 2370 }
2362 2371
2363 2372
2364 const int RelocInfo::kApplyMask = 1 << RelocInfo::INTERNAL_REFERENCE; 2373 const int RelocInfo::kApplyMask = 1 << RelocInfo::INTERNAL_REFERENCE;
2365 2374
2366 2375
2367 } } // namespace v8::internal 2376 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/builtins-x64.cc » ('j') | src/x64/builtins-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698