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

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

Issue 6771049: Allow construction of x64 Assembler with a NULL Isolate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: remove tab character from source file Created 9 years, 8 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 | « no previous file | src/x64/codegen-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
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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) 347 Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
348 : AssemblerBase(arg_isolate), 348 : AssemblerBase(arg_isolate),
349 code_targets_(100), 349 code_targets_(100),
350 positions_recorder_(this), 350 positions_recorder_(this),
351 emit_debug_code_(FLAG_debug_code) { 351 emit_debug_code_(FLAG_debug_code) {
352 if (buffer == NULL) { 352 if (buffer == NULL) {
353 // Do our own buffer management. 353 // Do our own buffer management.
354 if (buffer_size <= kMinimalBufferSize) { 354 if (buffer_size <= kMinimalBufferSize) {
355 buffer_size = kMinimalBufferSize; 355 buffer_size = kMinimalBufferSize;
356 356
357 if (isolate()->assembler_spare_buffer() != NULL) { 357 if (isolate() != NULL && isolate()->assembler_spare_buffer() != NULL) {
358 buffer = isolate()->assembler_spare_buffer(); 358 buffer = isolate()->assembler_spare_buffer();
359 isolate()->set_assembler_spare_buffer(NULL); 359 isolate()->set_assembler_spare_buffer(NULL);
360 } 360 }
361 } 361 }
362 if (buffer == NULL) { 362 if (buffer == NULL) {
363 buffer_ = NewArray<byte>(buffer_size); 363 buffer_ = NewArray<byte>(buffer_size);
364 } else { 364 } else {
365 buffer_ = static_cast<byte*>(buffer); 365 buffer_ = static_cast<byte*>(buffer);
366 } 366 }
367 buffer_size_ = buffer_size; 367 buffer_size_ = buffer_size;
(...skipping 23 matching lines...) Expand all
391 last_pc_ = NULL; 391 last_pc_ = NULL;
392 392
393 #ifdef GENERATED_CODE_COVERAGE 393 #ifdef GENERATED_CODE_COVERAGE
394 InitCoverageLog(); 394 InitCoverageLog();
395 #endif 395 #endif
396 } 396 }
397 397
398 398
399 Assembler::~Assembler() { 399 Assembler::~Assembler() {
400 if (own_buffer_) { 400 if (own_buffer_) {
401 if (isolate()->assembler_spare_buffer() == NULL && 401 if (isolate() != NULL &&
402 isolate()->assembler_spare_buffer() == NULL &&
402 buffer_size_ == kMinimalBufferSize) { 403 buffer_size_ == kMinimalBufferSize) {
403 isolate()->set_assembler_spare_buffer(buffer_); 404 isolate()->set_assembler_spare_buffer(buffer_);
404 } else { 405 } else {
405 DeleteArray(buffer_); 406 DeleteArray(buffer_);
406 } 407 }
407 } 408 }
408 } 409 }
409 410
410 411
411 void Assembler::GetCode(CodeDesc* desc) { 412 void Assembler::GetCode(CodeDesc* desc) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 515
515 // Copy the data. 516 // Copy the data.
516 intptr_t pc_delta = desc.buffer - buffer_; 517 intptr_t pc_delta = desc.buffer - buffer_;
517 intptr_t rc_delta = (desc.buffer + desc.buffer_size) - 518 intptr_t rc_delta = (desc.buffer + desc.buffer_size) -
518 (buffer_ + buffer_size_); 519 (buffer_ + buffer_size_);
519 memmove(desc.buffer, buffer_, desc.instr_size); 520 memmove(desc.buffer, buffer_, desc.instr_size);
520 memmove(rc_delta + reloc_info_writer.pos(), 521 memmove(rc_delta + reloc_info_writer.pos(),
521 reloc_info_writer.pos(), desc.reloc_size); 522 reloc_info_writer.pos(), desc.reloc_size);
522 523
523 // Switch buffers. 524 // Switch buffers.
524 if (isolate()->assembler_spare_buffer() == NULL && 525 if (isolate() != NULL &&
526 isolate()->assembler_spare_buffer() == NULL &&
525 buffer_size_ == kMinimalBufferSize) { 527 buffer_size_ == kMinimalBufferSize) {
526 isolate()->set_assembler_spare_buffer(buffer_); 528 isolate()->set_assembler_spare_buffer(buffer_);
527 } else { 529 } else {
528 DeleteArray(buffer_); 530 DeleteArray(buffer_);
529 } 531 }
530 buffer_ = desc.buffer; 532 buffer_ = desc.buffer;
531 buffer_size_ = desc.buffer_size; 533 buffer_size_ = desc.buffer_size;
532 pc_ += pc_delta; 534 pc_ += pc_delta;
533 if (last_pc_ != NULL) { 535 if (last_pc_ != NULL) {
534 last_pc_ += pc_delta; 536 last_pc_ += pc_delta;
(...skipping 2634 matching lines...) Expand 10 before | Expand all | Expand 10 after
3169 // specially coded on x64 means that it is a relative 32 bit address, as used 3171 // specially coded on x64 means that it is a relative 32 bit address, as used
3170 // by branch instructions. 3172 // by branch instructions.
3171 return (1 << rmode_) & kApplyMask; 3173 return (1 << rmode_) & kApplyMask;
3172 } 3174 }
3173 3175
3174 3176
3175 3177
3176 } } // namespace v8::internal 3178 } } // namespace v8::internal
3177 3179
3178 #endif // V8_TARGET_ARCH_X64 3180 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698