OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 // from upper to lower addresses. | 551 // from upper to lower addresses. |
552 void Write(const RelocInfo* rinfo) { | 552 void Write(const RelocInfo* rinfo) { |
553 if (buffer_ + kBufferGap >= reloc_info_writer_.pos()) { | 553 if (buffer_ + kBufferGap >= reloc_info_writer_.pos()) { |
554 Grow(); | 554 Grow(); |
555 } | 555 } |
556 reloc_info_writer_.Write(rinfo); | 556 reloc_info_writer_.Write(rinfo); |
557 } | 557 } |
558 | 558 |
559 Vector<byte> GetResult() { | 559 Vector<byte> GetResult() { |
560 // Return the bytes from pos up to end of buffer. | 560 // Return the bytes from pos up to end of buffer. |
561 return Vector<byte>(reloc_info_writer_.pos(), | 561 int result_size = |
562 buffer_ + buffer_size_ - reloc_info_writer_.pos()); | 562 static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer_.pos()); |
| 563 return Vector<byte>(reloc_info_writer_.pos(), result_size); |
563 } | 564 } |
564 | 565 |
565 private: | 566 private: |
566 void Grow() { | 567 void Grow() { |
567 // Compute new buffer size. | 568 // Compute new buffer size. |
568 int new_buffer_size; | 569 int new_buffer_size; |
569 if (buffer_size_ < 2 * KB) { | 570 if (buffer_size_ < 2 * KB) { |
570 new_buffer_size = 4 * KB; | 571 new_buffer_size = 4 * KB; |
571 } else { | 572 } else { |
572 new_buffer_size = 2 * buffer_size_; | 573 new_buffer_size = 2 * buffer_size_; |
573 } | 574 } |
574 // Some internal data structures overflow for very large buffers, | 575 // Some internal data structures overflow for very large buffers, |
575 // they must ensure that kMaximalBufferSize is not too large. | 576 // they must ensure that kMaximalBufferSize is not too large. |
576 if (new_buffer_size > kMaximalBufferSize) { | 577 if (new_buffer_size > kMaximalBufferSize) { |
577 V8::FatalProcessOutOfMemory("RelocInfoBuffer::GrowBuffer"); | 578 V8::FatalProcessOutOfMemory("RelocInfoBuffer::GrowBuffer"); |
578 } | 579 } |
579 | 580 |
580 // Setup new buffer. | 581 // Setup new buffer. |
581 byte* new_buffer = NewArray<byte>(new_buffer_size); | 582 byte* new_buffer = NewArray<byte>(new_buffer_size); |
582 | 583 |
583 // Copy the data. | 584 // Copy the data. |
584 int curently_used_size = buffer_ + buffer_size_ - reloc_info_writer_.pos(); | 585 int curently_used_size = |
| 586 static_cast<int>(buffer_ + buffer_size_ - reloc_info_writer_.pos()); |
585 memmove(new_buffer + new_buffer_size - curently_used_size, | 587 memmove(new_buffer + new_buffer_size - curently_used_size, |
586 reloc_info_writer_.pos(), curently_used_size); | 588 reloc_info_writer_.pos(), curently_used_size); |
587 | 589 |
588 reloc_info_writer_.Reposition( | 590 reloc_info_writer_.Reposition( |
589 new_buffer + new_buffer_size - curently_used_size, | 591 new_buffer + new_buffer_size - curently_used_size, |
590 reloc_info_writer_.last_pc()); | 592 reloc_info_writer_.last_pc()); |
591 | 593 |
592 DeleteArray(buffer_); | 594 DeleteArray(buffer_); |
593 buffer_ = new_buffer; | 595 buffer_ = new_buffer; |
594 buffer_size_ = new_buffer_size; | 596 buffer_size_ = new_buffer_size; |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 ThreadManager::IterateThreads(&inactive_threads_checker); | 981 ThreadManager::IterateThreads(&inactive_threads_checker); |
980 if (inactive_threads_checker.HasBlockedFunctions()) { | 982 if (inactive_threads_checker.HasBlockedFunctions()) { |
981 return result; | 983 return result; |
982 } | 984 } |
983 | 985 |
984 // Try to drop activations from the current stack. | 986 // Try to drop activations from the current stack. |
985 const char* error_message = | 987 const char* error_message = |
986 DropActivationsInActiveThread(shared_info_array, result, do_drop); | 988 DropActivationsInActiveThread(shared_info_array, result, do_drop); |
987 if (error_message != NULL) { | 989 if (error_message != NULL) { |
988 // Add error message as an array extra element. | 990 // Add error message as an array extra element. |
989 Vector<const char> vector_message(error_message, strlen(error_message)); | 991 Vector<const char> vector_message(error_message, StrLength(error_message)); |
990 Handle<String> str = Factory::NewStringFromAscii(vector_message); | 992 Handle<String> str = Factory::NewStringFromAscii(vector_message); |
991 SetElement(result, len, str); | 993 SetElement(result, len, str); |
992 } | 994 } |
993 return result; | 995 return result; |
994 } | 996 } |
995 | 997 |
996 | 998 |
997 LiveEditFunctionTracker::LiveEditFunctionTracker(FunctionLiteral* fun) { | 999 LiveEditFunctionTracker::LiveEditFunctionTracker(FunctionLiteral* fun) { |
998 if (active_function_info_listener != NULL) { | 1000 if (active_function_info_listener != NULL) { |
999 active_function_info_listener->FunctionStarted(fun); | 1001 active_function_info_listener->FunctionStarted(fun); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 | 1051 |
1050 bool LiveEditFunctionTracker::IsActive() { | 1052 bool LiveEditFunctionTracker::IsActive() { |
1051 return false; | 1053 return false; |
1052 } | 1054 } |
1053 | 1055 |
1054 #endif // ENABLE_DEBUGGER_SUPPORT | 1056 #endif // ENABLE_DEBUGGER_SUPPORT |
1055 | 1057 |
1056 | 1058 |
1057 | 1059 |
1058 } } // namespace v8::internal | 1060 } } // namespace v8::internal |
OLD | NEW |