| OLD | NEW |
| 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 4978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4989 return Utils::ToLocal(value); | 4989 return Utils::ToLocal(value); |
| 4990 } | 4990 } |
| 4991 | 4991 |
| 4992 | 4992 |
| 4993 void v8::Object::SetInternalField(int index, v8::Handle<Value> value) { | 4993 void v8::Object::SetInternalField(int index, v8::Handle<Value> value) { |
| 4994 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 4994 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
| 4995 const char* location = "v8::Object::SetInternalField()"; | 4995 const char* location = "v8::Object::SetInternalField()"; |
| 4996 if (!InternalFieldOK(obj, index, location)) return; | 4996 if (!InternalFieldOK(obj, index, location)) return; |
| 4997 i::Handle<i::Object> val = Utils::OpenHandle(*value); | 4997 i::Handle<i::Object> val = Utils::OpenHandle(*value); |
| 4998 obj->SetInternalField(index, *val); | 4998 obj->SetInternalField(index, *val); |
| 4999 DCHECK_EQ(value, GetInternalField(index)); | 4999 DCHECK(value->Equals(GetInternalField(index))); |
| 5000 } | 5000 } |
| 5001 | 5001 |
| 5002 | 5002 |
| 5003 void* v8::Object::SlowGetAlignedPointerFromInternalField(int index) { | 5003 void* v8::Object::SlowGetAlignedPointerFromInternalField(int index) { |
| 5004 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 5004 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
| 5005 const char* location = "v8::Object::GetAlignedPointerFromInternalField()"; | 5005 const char* location = "v8::Object::GetAlignedPointerFromInternalField()"; |
| 5006 if (!InternalFieldOK(obj, index, location)) return NULL; | 5006 if (!InternalFieldOK(obj, index, location)) return NULL; |
| 5007 return DecodeSmiToAligned(obj->GetInternalField(index), location); | 5007 return DecodeSmiToAligned(obj->GetInternalField(index), location); |
| 5008 } | 5008 } |
| 5009 | 5009 |
| (...skipping 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7350 "v8::HeapSnapshot::Serialize", | 7350 "v8::HeapSnapshot::Serialize", |
| 7351 "Unknown serialization format"); | 7351 "Unknown serialization format"); |
| 7352 Utils::ApiCheck(stream->GetChunkSize() > 0, | 7352 Utils::ApiCheck(stream->GetChunkSize() > 0, |
| 7353 "v8::HeapSnapshot::Serialize", | 7353 "v8::HeapSnapshot::Serialize", |
| 7354 "Invalid stream chunk size"); | 7354 "Invalid stream chunk size"); |
| 7355 i::HeapSnapshotJSONSerializer serializer(ToInternal(this)); | 7355 i::HeapSnapshotJSONSerializer serializer(ToInternal(this)); |
| 7356 serializer.Serialize(stream); | 7356 serializer.Serialize(stream); |
| 7357 } | 7357 } |
| 7358 | 7358 |
| 7359 | 7359 |
| 7360 // static |
| 7361 STATIC_CONST_MEMBER_DEFINITION const SnapshotObjectId |
| 7362 HeapProfiler::kUnknownObjectId; |
| 7363 |
| 7364 |
| 7360 int HeapProfiler::GetSnapshotCount() { | 7365 int HeapProfiler::GetSnapshotCount() { |
| 7361 return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotsCount(); | 7366 return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotsCount(); |
| 7362 } | 7367 } |
| 7363 | 7368 |
| 7364 | 7369 |
| 7365 const HeapSnapshot* HeapProfiler::GetHeapSnapshot(int index) { | 7370 const HeapSnapshot* HeapProfiler::GetHeapSnapshot(int index) { |
| 7366 return reinterpret_cast<const HeapSnapshot*>( | 7371 return reinterpret_cast<const HeapSnapshot*>( |
| 7367 reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshot(index)); | 7372 reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshot(index)); |
| 7368 } | 7373 } |
| 7369 | 7374 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7669 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7674 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7670 Address callback_address = | 7675 Address callback_address = |
| 7671 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7676 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7672 VMState<EXTERNAL> state(isolate); | 7677 VMState<EXTERNAL> state(isolate); |
| 7673 ExternalCallbackScope call_scope(isolate, callback_address); | 7678 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7674 callback(info); | 7679 callback(info); |
| 7675 } | 7680 } |
| 7676 | 7681 |
| 7677 | 7682 |
| 7678 } } // namespace v8::internal | 7683 } } // namespace v8::internal |
| OLD | NEW |