OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value)); | 1676 Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value)); |
1677 } | 1677 } |
1678 | 1678 |
1679 | 1679 |
1680 // --- S c r i p t D a t a --- | 1680 // --- S c r i p t D a t a --- |
1681 | 1681 |
1682 | 1682 |
1683 ScriptData* ScriptData::PreCompile(const char* input, int length) { | 1683 ScriptData* ScriptData::PreCompile(const char* input, int length) { |
1684 i::Utf8ToUtf16CharacterStream stream( | 1684 i::Utf8ToUtf16CharacterStream stream( |
1685 reinterpret_cast<const unsigned char*>(input), length); | 1685 reinterpret_cast<const unsigned char*>(input), length); |
1686 return i::PreParserApi::PreParse(&stream); | 1686 return i::PreParserApi::PreParse(i::Isolate::Current(), &stream); |
1687 } | 1687 } |
1688 | 1688 |
1689 | 1689 |
1690 ScriptData* ScriptData::PreCompile(v8::Handle<String> source) { | 1690 ScriptData* ScriptData::PreCompile(v8::Handle<String> source) { |
1691 i::Handle<i::String> str = Utils::OpenHandle(*source); | 1691 i::Handle<i::String> str = Utils::OpenHandle(*source); |
| 1692 i::Isolate* isolate = str->GetIsolate(); |
1692 if (str->IsExternalTwoByteString()) { | 1693 if (str->IsExternalTwoByteString()) { |
1693 i::ExternalTwoByteStringUtf16CharacterStream stream( | 1694 i::ExternalTwoByteStringUtf16CharacterStream stream( |
1694 i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length()); | 1695 i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length()); |
1695 return i::PreParserApi::PreParse(&stream); | 1696 return i::PreParserApi::PreParse(isolate, &stream); |
1696 } else { | 1697 } else { |
1697 i::GenericStringUtf16CharacterStream stream(str, 0, str->length()); | 1698 i::GenericStringUtf16CharacterStream stream(str, 0, str->length()); |
1698 return i::PreParserApi::PreParse(&stream); | 1699 return i::PreParserApi::PreParse(isolate, &stream); |
1699 } | 1700 } |
1700 } | 1701 } |
1701 | 1702 |
1702 | 1703 |
1703 ScriptData* ScriptData::New(const char* data, int length) { | 1704 ScriptData* ScriptData::New(const char* data, int length) { |
1704 // Return an empty ScriptData if the length is obviously invalid. | 1705 // Return an empty ScriptData if the length is obviously invalid. |
1705 if (length % sizeof(unsigned) != 0) { | 1706 if (length % sizeof(unsigned) != 0) { |
1706 return new i::ScriptDataImpl(); | 1707 return new i::ScriptDataImpl(); |
1707 } | 1708 } |
1708 | 1709 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2282 // --- S t a c k T r a c e --- | 2283 // --- S t a c k T r a c e --- |
2283 | 2284 |
2284 Local<StackFrame> StackTrace::GetFrame(uint32_t index) const { | 2285 Local<StackFrame> StackTrace::GetFrame(uint32_t index) const { |
2285 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2286 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
2286 if (IsDeadCheck(isolate, "v8::StackTrace::GetFrame()")) { | 2287 if (IsDeadCheck(isolate, "v8::StackTrace::GetFrame()")) { |
2287 return Local<StackFrame>(); | 2288 return Local<StackFrame>(); |
2288 } | 2289 } |
2289 ENTER_V8(isolate); | 2290 ENTER_V8(isolate); |
2290 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); | 2291 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); |
2291 i::Handle<i::JSArray> self = Utils::OpenHandle(this); | 2292 i::Handle<i::JSArray> self = Utils::OpenHandle(this); |
2292 i::Object* raw_object = self->GetElementNoExceptionThrown(index); | 2293 i::Object* raw_object = self->GetElementNoExceptionThrown(isolate, index); |
2293 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object)); | 2294 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object)); |
2294 return scope.Close(Utils::StackFrameToLocal(obj)); | 2295 return scope.Close(Utils::StackFrameToLocal(obj)); |
2295 } | 2296 } |
2296 | 2297 |
2297 | 2298 |
2298 int StackTrace::GetFrameCount() const { | 2299 int StackTrace::GetFrameCount() const { |
2299 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2300 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
2300 if (IsDeadCheck(isolate, "v8::StackTrace::GetFrameCount()")) return -1; | 2301 if (IsDeadCheck(isolate, "v8::StackTrace::GetFrameCount()")) return -1; |
2301 ENTER_V8(isolate); | 2302 ENTER_V8(isolate); |
2302 return i::Smi::cast(Utils::OpenHandle(this)->length())->value(); | 2303 return i::Smi::cast(Utils::OpenHandle(this)->length())->value(); |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3355 return Utils::ToLocal(result); | 3356 return Utils::ToLocal(result); |
3356 } | 3357 } |
3357 | 3358 |
3358 | 3359 |
3359 Local<Value> v8::Object::Get(uint32_t index) { | 3360 Local<Value> v8::Object::Get(uint32_t index) { |
3360 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3361 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3361 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>()); | 3362 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>()); |
3362 ENTER_V8(isolate); | 3363 ENTER_V8(isolate); |
3363 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3364 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
3364 EXCEPTION_PREAMBLE(isolate); | 3365 EXCEPTION_PREAMBLE(isolate); |
3365 i::Handle<i::Object> result = i::Object::GetElement(self, index); | 3366 i::Handle<i::Object> result = i::Object::GetElement(isolate, self, index); |
3366 has_pending_exception = result.is_null(); | 3367 has_pending_exception = result.is_null(); |
3367 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); | 3368 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |
3368 return Utils::ToLocal(result); | 3369 return Utils::ToLocal(result); |
3369 } | 3370 } |
3370 | 3371 |
3371 | 3372 |
3372 PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) { | 3373 PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) { |
3373 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3374 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3374 ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()", | 3375 ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()", |
3375 return static_cast<PropertyAttribute>(NONE)); | 3376 return static_cast<PropertyAttribute>(NONE)); |
(...skipping 4490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7866 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7867 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7867 Address callback_address = | 7868 Address callback_address = |
7868 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7869 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7869 VMState<EXTERNAL> state(isolate); | 7870 VMState<EXTERNAL> state(isolate); |
7870 ExternalCallbackScope call_scope(isolate, callback_address); | 7871 ExternalCallbackScope call_scope(isolate, callback_address); |
7871 return callback(info); | 7872 return callback(info); |
7872 } | 7873 } |
7873 | 7874 |
7874 | 7875 |
7875 } } // namespace v8::internal | 7876 } } // namespace v8::internal |
OLD | NEW |