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

Side by Side Diff: src/api.cc

Issue 297303004: Revert 21502 - "Move OS::MemCopy and OS::MemMove out of platform to utils" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | « src/allocation.cc ('k') | src/arm/assembler-arm.cc » ('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 "api.h" 5 #include "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 3257 matching lines...) Expand 10 before | Expand all | Expand 10 after
3268 3268
3269 int prefix_len = i::StrLength(prefix); 3269 int prefix_len = i::StrLength(prefix);
3270 int str_len = str->Utf8Length(); 3270 int str_len = str->Utf8Length();
3271 int postfix_len = i::StrLength(postfix); 3271 int postfix_len = i::StrLength(postfix);
3272 3272
3273 int buf_len = prefix_len + str_len + postfix_len; 3273 int buf_len = prefix_len + str_len + postfix_len;
3274 i::ScopedVector<char> buf(buf_len); 3274 i::ScopedVector<char> buf(buf_len);
3275 3275
3276 // Write prefix. 3276 // Write prefix.
3277 char* ptr = buf.start(); 3277 char* ptr = buf.start();
3278 i::MemCopy(ptr, prefix, prefix_len * v8::internal::kCharSize); 3278 i::OS::MemCopy(ptr, prefix, prefix_len * v8::internal::kCharSize);
3279 ptr += prefix_len; 3279 ptr += prefix_len;
3280 3280
3281 // Write real content. 3281 // Write real content.
3282 str->WriteUtf8(ptr, str_len); 3282 str->WriteUtf8(ptr, str_len);
3283 ptr += str_len; 3283 ptr += str_len;
3284 3284
3285 // Write postfix. 3285 // Write postfix.
3286 i::MemCopy(ptr, postfix, postfix_len * v8::internal::kCharSize); 3286 i::OS::MemCopy(ptr, postfix, postfix_len * v8::internal::kCharSize);
3287 3287
3288 // Copy the buffer into a heap-allocated string and return it. 3288 // Copy the buffer into a heap-allocated string and return it.
3289 Local<String> result = v8::String::NewFromUtf8( 3289 Local<String> result = v8::String::NewFromUtf8(
3290 isolate, buf.start(), String::kNormalString, buf_len); 3290 isolate, buf.start(), String::kNormalString, buf_len);
3291 return result; 3291 return result;
3292 } 3292 }
3293 } 3293 }
3294 } 3294 }
3295 3295
3296 3296
(...skipping 4110 matching lines...) Expand 10 before | Expand all | Expand 10 after
7407 7407
7408 7408
7409 void HandleScopeImplementer::FreeThreadResources() { 7409 void HandleScopeImplementer::FreeThreadResources() {
7410 Free(); 7410 Free();
7411 } 7411 }
7412 7412
7413 7413
7414 char* HandleScopeImplementer::ArchiveThread(char* storage) { 7414 char* HandleScopeImplementer::ArchiveThread(char* storage) {
7415 HandleScopeData* current = isolate_->handle_scope_data(); 7415 HandleScopeData* current = isolate_->handle_scope_data();
7416 handle_scope_data_ = *current; 7416 handle_scope_data_ = *current;
7417 MemCopy(storage, this, sizeof(*this)); 7417 OS::MemCopy(storage, this, sizeof(*this));
7418 7418
7419 ResetAfterArchive(); 7419 ResetAfterArchive();
7420 current->Initialize(); 7420 current->Initialize();
7421 7421
7422 return storage + ArchiveSpacePerThread(); 7422 return storage + ArchiveSpacePerThread();
7423 } 7423 }
7424 7424
7425 7425
7426 int HandleScopeImplementer::ArchiveSpacePerThread() { 7426 int HandleScopeImplementer::ArchiveSpacePerThread() {
7427 return sizeof(HandleScopeImplementer); 7427 return sizeof(HandleScopeImplementer);
7428 } 7428 }
7429 7429
7430 7430
7431 char* HandleScopeImplementer::RestoreThread(char* storage) { 7431 char* HandleScopeImplementer::RestoreThread(char* storage) {
7432 MemCopy(this, storage, sizeof(*this)); 7432 OS::MemCopy(this, storage, sizeof(*this));
7433 *isolate_->handle_scope_data() = handle_scope_data_; 7433 *isolate_->handle_scope_data() = handle_scope_data_;
7434 return storage + ArchiveSpacePerThread(); 7434 return storage + ArchiveSpacePerThread();
7435 } 7435 }
7436 7436
7437 7437
7438 void HandleScopeImplementer::IterateThis(ObjectVisitor* v) { 7438 void HandleScopeImplementer::IterateThis(ObjectVisitor* v) {
7439 #ifdef DEBUG 7439 #ifdef DEBUG
7440 bool found_block_before_deferred = false; 7440 bool found_block_before_deferred = false;
7441 #endif 7441 #endif
7442 // Iterate over all handles in the blocks except for the last. 7442 // Iterate over all handles in the blocks except for the last.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
7566 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7566 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7567 Address callback_address = 7567 Address callback_address =
7568 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7568 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7569 VMState<EXTERNAL> state(isolate); 7569 VMState<EXTERNAL> state(isolate);
7570 ExternalCallbackScope call_scope(isolate, callback_address); 7570 ExternalCallbackScope call_scope(isolate, callback_address);
7571 callback(info); 7571 callback(info);
7572 } 7572 }
7573 7573
7574 7574
7575 } } // namespace v8::internal 7575 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/allocation.cc ('k') | src/arm/assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698