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

Side by Side Diff: src/api.cc

Issue 617263003: Introduce v8::Object::GetIsolate(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | « include/v8.h ('k') | test/cctest/test-api.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 "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 5590 matching lines...) Expand 10 before | Expand all | Expand 10 after
5601 i::Isolate* isolate = obj->GetIsolate(); 5601 i::Isolate* isolate = obj->GetIsolate();
5602 5602
5603 if (isolate->string_tracker()->IsFreshUnusedString(obj)) return false; 5603 if (isolate->string_tracker()->IsFreshUnusedString(obj)) return false;
5604 int size = obj->Size(); // Byte size of the original string. 5604 int size = obj->Size(); // Byte size of the original string.
5605 if (size < i::ExternalString::kShortSize) return false; 5605 if (size < i::ExternalString::kShortSize) return false;
5606 i::StringShape shape(*obj); 5606 i::StringShape shape(*obj);
5607 return !shape.IsExternal(); 5607 return !shape.IsExternal();
5608 } 5608 }
5609 5609
5610 5610
5611 Isolate* v8::Object::GetIsolate() {
aandrey 2014/10/01 13:21:02 v8::Value ?
5612 i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate();
5613 return reinterpret_cast<Isolate*>(i_isolate);
5614 }
5615
5616
5611 Local<v8::Object> v8::Object::New(Isolate* isolate) { 5617 Local<v8::Object> v8::Object::New(Isolate* isolate) {
5612 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 5618 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
5613 LOG_API(i_isolate, "Object::New"); 5619 LOG_API(i_isolate, "Object::New");
5614 ENTER_V8(i_isolate); 5620 ENTER_V8(i_isolate);
5615 i::Handle<i::JSObject> obj = 5621 i::Handle<i::JSObject> obj =
5616 i_isolate->factory()->NewJSObject(i_isolate->object_function()); 5622 i_isolate->factory()->NewJSObject(i_isolate->object_function());
5617 return Utils::ToLocal(obj); 5623 return Utils::ToLocal(obj);
5618 } 5624 }
5619 5625
5620 5626
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after
7707 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7713 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7708 Address callback_address = 7714 Address callback_address =
7709 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7715 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7710 VMState<EXTERNAL> state(isolate); 7716 VMState<EXTERNAL> state(isolate);
7711 ExternalCallbackScope call_scope(isolate, callback_address); 7717 ExternalCallbackScope call_scope(isolate, callback_address);
7712 callback(info); 7718 callback(info);
7713 } 7719 }
7714 7720
7715 7721
7716 } } // namespace v8::internal 7722 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698