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

Side by Side Diff: src/d8.cc

Issue 1110603005: Remove support for malloc'd typed arrays (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 7 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
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 // Defined when linking against shared lib on Windows. 6 // Defined when linking against shared lib on Windows.
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED)
8 #define V8_SHARED 8 #define V8_SHARED
9 #endif 9 #endif
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 CounterCollection* Shell::counters_ = &local_counters_; 159 CounterCollection* Shell::counters_ = &local_counters_;
160 base::Mutex Shell::context_mutex_; 160 base::Mutex Shell::context_mutex_;
161 const base::TimeTicks Shell::kInitialTicks = 161 const base::TimeTicks Shell::kInitialTicks =
162 base::TimeTicks::HighResolutionNow(); 162 base::TimeTicks::HighResolutionNow();
163 Persistent<Context> Shell::utility_context_; 163 Persistent<Context> Shell::utility_context_;
164 #endif // !V8_SHARED 164 #endif // !V8_SHARED
165 165
166 Persistent<Context> Shell::evaluation_context_; 166 Persistent<Context> Shell::evaluation_context_;
167 ShellOptions Shell::options; 167 ShellOptions Shell::options;
168 const char* Shell::kPrompt = "d8> "; 168 const char* Shell::kPrompt = "d8> ";
169 169 const int MB = 1024 * 1024;
170 170
171 #ifndef V8_SHARED 171 #ifndef V8_SHARED
172 const int MB = 1024 * 1024;
173
174 bool CounterMap::Match(void* key1, void* key2) { 172 bool CounterMap::Match(void* key1, void* key2) {
175 const char* name1 = reinterpret_cast<const char*>(key1); 173 const char* name1 = reinterpret_cast<const char*>(key1);
176 const char* name2 = reinterpret_cast<const char*>(key2); 174 const char* name2 = reinterpret_cast<const char*>(key2);
177 return strcmp(name1, name2) == 0; 175 return strcmp(name1, name2) == 0;
178 } 176 }
179 #endif // !V8_SHARED 177 #endif // !V8_SHARED
180 178
181 179
182 // Converts a V8 value to a C string. 180 // Converts a V8 value to a C string.
183 const char* Shell::ToCString(const v8::String::Utf8Value& value) { 181 const char* Shell::ToCString(const v8::String::Utf8Value& value) {
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 void* data = AllocateUninitialized(length); 1590 void* data = AllocateUninitialized(length);
1593 return data == NULL ? data : memset(data, 0, length); 1591 return data == NULL ? data : memset(data, 0, length);
1594 } 1592 }
1595 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } 1593 virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
1596 virtual void Free(void* data, size_t) { free(data); } 1594 virtual void Free(void* data, size_t) { free(data); }
1597 }; 1595 };
1598 1596
1599 1597
1600 class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 1598 class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
1601 public: 1599 public:
1602 void* Allocate(size_t) override { return malloc(1); } 1600 void* Allocate(size_t length) override {
1603 void* AllocateUninitialized(size_t length) override { return malloc(1); } 1601 size_t actual_length = length > 10 * MB ? 1 : length;
1602 void* data = AllocateUninitialized(actual_length);
1603 return data == NULL ? data : memset(data, 0, actual_length);
1604 }
1605 void* AllocateUninitialized(size_t length) override {
1606 return length > 10 * MB ? malloc(1) : malloc(length);
1607 }
1604 void Free(void* p, size_t) override { free(p); } 1608 void Free(void* p, size_t) override { free(p); }
1605 }; 1609 };
1606 1610
1607 1611
1608 int Shell::Main(int argc, char* argv[]) { 1612 int Shell::Main(int argc, char* argv[]) {
1609 #if (defined(_WIN32) || defined(_WIN64)) 1613 #if (defined(_WIN32) || defined(_WIN64))
1610 UINT new_flags = 1614 UINT new_flags =
1611 SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX; 1615 SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
1612 UINT existing_flags = SetErrorMode(new_flags); 1616 UINT existing_flags = SetErrorMode(new_flags);
1613 SetErrorMode(existing_flags | new_flags); 1617 SetErrorMode(existing_flags | new_flags);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 } 1736 }
1733 1737
1734 } // namespace v8 1738 } // namespace v8
1735 1739
1736 1740
1737 #ifndef GOOGLE3 1741 #ifndef GOOGLE3
1738 int main(int argc, char* argv[]) { 1742 int main(int argc, char* argv[]) {
1739 return v8::Shell::Main(argc, argv); 1743 return v8::Shell::Main(argc, argv);
1740 } 1744 }
1741 #endif 1745 #endif
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698