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

Unified Diff: src/arm/assembler-arm.cc

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/builtins-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/assembler-arm.cc
===================================================================
--- src/arm/assembler-arm.cc (revision 3427)
+++ src/arm/assembler-arm.cc (working copy)
@@ -329,17 +329,26 @@
// spare_buffer_
static const int kMinimalBufferSize = 4*KB;
-static byte* spare_buffer_ = NULL;
+class AssemblerData:public BasicAssemblerData {
+ public:
+ // A previously allocated buffer of kMinimalBufferSize bytes, or NULL.
+ byte* spare_buffer_;
+ private:
+ AssemblerData() :spare_buffer_(NULL) {}
+ ~AssemblerData() { delete spare_buffer_; }
+ friend class Assembler;
+ DISALLOW_COPY_AND_ASSIGN(AssemblerData);
+};
Assembler::Assembler(void* buffer, int buffer_size) {
if (buffer == NULL) {
// do our own buffer management
if (buffer_size <= kMinimalBufferSize) {
buffer_size = kMinimalBufferSize;
-
- if (spare_buffer_ != NULL) {
- buffer = spare_buffer_;
- spare_buffer_ = NULL;
+ AssemblerData* const data = v8_context()->assembler_data_;
+ if (data->spare_buffer_ != NULL) {
+ buffer = data->spare_buffer_;
+ data->spare_buffer_ = NULL;
}
}
if (buffer == NULL) {
@@ -376,8 +385,9 @@
Assembler::~Assembler() {
if (own_buffer_) {
- if (spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) {
- spare_buffer_ = buffer_;
+ AssemblerData* const data = v8_context()->assembler_data_;
+ if (data->spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) {
+ data->spare_buffer_ = buffer_;
} else {
DeleteArray(buffer_);
}
@@ -1827,5 +1837,12 @@
next_buffer_check_ = pc_offset() + kCheckConstInterval;
}
+void Assembler::PostConstruct() {
+ v8_context()->assembler_data_ = new AssemblerData();
+}
+void Assembler::PreDestroy() {
+ delete v8_context()->assembler_data_;
+}
+
} } // namespace v8::internal
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/builtins-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698