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

Side by Side Diff: src/api.cc

Issue 916753002: remove undetectable strings (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « include/v8.h ('k') | src/heap/heap.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 #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 5414 matching lines...) Expand 10 before | Expand all | Expand 10 after
5425 5425
5426 template<typename Char> 5426 template<typename Char>
5427 inline Local<String> NewString(Isolate* v8_isolate, 5427 inline Local<String> NewString(Isolate* v8_isolate,
5428 const char* location, 5428 const char* location,
5429 const char* env, 5429 const char* env,
5430 const Char* data, 5430 const Char* data,
5431 String::NewStringType type, 5431 String::NewStringType type,
5432 int length) { 5432 int length) {
5433 i::Isolate* isolate = reinterpret_cast<internal::Isolate*>(v8_isolate); 5433 i::Isolate* isolate = reinterpret_cast<internal::Isolate*>(v8_isolate);
5434 LOG_API(isolate, env); 5434 LOG_API(isolate, env);
5435 if (length == 0 && type != String::kUndetectableString) { 5435 if (length == 0) {
5436 return String::Empty(v8_isolate); 5436 return String::Empty(v8_isolate);
5437 } 5437 }
5438 ENTER_V8(isolate); 5438 ENTER_V8(isolate);
5439 if (length == -1) length = StringLength(data); 5439 if (length == -1) length = StringLength(data);
5440 // We do not expect this to fail. Change this if it does. 5440 // We do not expect this to fail. Change this if it does.
5441 i::Handle<i::String> result = NewString( 5441 i::Handle<i::String> result = NewString(
5442 isolate->factory(), 5442 isolate->factory(),
5443 type, 5443 type,
5444 i::Vector<const Char>(data, length)).ToHandleChecked(); 5444 i::Vector<const Char>(data, length)).ToHandleChecked();
5445 if (type == String::kUndetectableString) {
5446 result->MarkAsUndetectable();
5447 }
5448 return Utils::ToLocal(result); 5445 return Utils::ToLocal(result);
5449 } 5446 }
5450 5447
5451 } // anonymous namespace 5448 } // anonymous namespace
5452 5449
5453 5450
5454 Local<String> String::NewFromUtf8(Isolate* isolate, 5451 Local<String> String::NewFromUtf8(Isolate* isolate,
5455 const char* data, 5452 const char* data,
5456 NewStringType type, 5453 NewStringType type,
5457 int length) { 5454 int length) {
(...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after
7740 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7737 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7741 Address callback_address = 7738 Address callback_address =
7742 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7739 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7743 VMState<EXTERNAL> state(isolate); 7740 VMState<EXTERNAL> state(isolate);
7744 ExternalCallbackScope call_scope(isolate, callback_address); 7741 ExternalCallbackScope call_scope(isolate, callback_address);
7745 callback(info); 7742 callback(info);
7746 } 7743 }
7747 7744
7748 7745
7749 } } // namespace v8::internal 7746 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698