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

Side by Side Diff: src/api.cc

Issue 470913002: Revert 23058 - "Allow externalizing cons and sliced string." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | no next file » | 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 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 5533 matching lines...) Expand 10 before | Expand all | Expand 10 after
5544 } 5544 }
5545 return result; 5545 return result;
5546 } 5546 }
5547 5547
5548 5548
5549 bool v8::String::CanMakeExternal() { 5549 bool v8::String::CanMakeExternal() {
5550 if (!internal::FLAG_clever_optimizations) return false; 5550 if (!internal::FLAG_clever_optimizations) return false;
5551 i::Handle<i::String> obj = Utils::OpenHandle(this); 5551 i::Handle<i::String> obj = Utils::OpenHandle(this);
5552 i::Isolate* isolate = obj->GetIsolate(); 5552 i::Isolate* isolate = obj->GetIsolate();
5553 5553
5554 // TODO(yangguo): Externalizing sliced/cons strings allocates.
5555 // This rule can be removed when all code that can
5556 // trigger an access check is handlified and therefore GC safe.
5557 if (isolate->heap()->old_pointer_space()->Contains(*obj)) return false;
5558
5554 if (isolate->string_tracker()->IsFreshUnusedString(obj)) return false; 5559 if (isolate->string_tracker()->IsFreshUnusedString(obj)) return false;
5555 int size = obj->Size(); // Byte size of the original string. 5560 int size = obj->Size(); // Byte size of the original string.
5556 if (size < i::ExternalString::kShortSize) return false; 5561 if (size < i::ExternalString::kShortSize) return false;
5557 i::StringShape shape(*obj); 5562 i::StringShape shape(*obj);
5558 return !shape.IsExternal(); 5563 return !shape.IsExternal();
5559 } 5564 }
5560 5565
5561 5566
5562 Local<v8::Object> v8::Object::New(Isolate* isolate) { 5567 Local<v8::Object> v8::Object::New(Isolate* isolate) {
5563 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 5568 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
(...skipping 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after
7639 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7644 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7640 Address callback_address = 7645 Address callback_address =
7641 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7646 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7642 VMState<EXTERNAL> state(isolate); 7647 VMState<EXTERNAL> state(isolate);
7643 ExternalCallbackScope call_scope(isolate, callback_address); 7648 ExternalCallbackScope call_scope(isolate, callback_address);
7644 callback(info); 7649 callback(info);
7645 } 7650 }
7646 7651
7647 7652
7648 } } // namespace v8::internal 7653 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698