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 7203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7214 str_ = i::NewArray<uint16_t>(length_ + 1); | 7214 str_ = i::NewArray<uint16_t>(length_ + 1); |
7215 str->Write(str_); | 7215 str->Write(str_); |
7216 } | 7216 } |
7217 | 7217 |
7218 | 7218 |
7219 String::Value::~Value() { | 7219 String::Value::~Value() { |
7220 i::DeleteArray(str_); | 7220 i::DeleteArray(str_); |
7221 } | 7221 } |
7222 | 7222 |
7223 | 7223 |
7224 #define DEFINE_ERROR(NAME) \ | 7224 #define DEFINE_ERROR(NAME) \ |
7225 Local<Value> Exception::NAME(v8::Handle<v8::String> raw_message) { \ | 7225 Local<Value> Exception::NAME(v8::Handle<v8::String> raw_message) { \ |
7226 i::Isolate* isolate = i::Isolate::Current(); \ | 7226 i::Isolate* isolate = i::Isolate::Current(); \ |
7227 LOG_API(isolate, #NAME); \ | 7227 LOG_API(isolate, #NAME); \ |
7228 ENTER_V8(isolate); \ | 7228 ENTER_V8(isolate); \ |
7229 i::Object* error; \ | 7229 i::Object* error; \ |
7230 { \ | 7230 { \ |
7231 i::HandleScope scope(isolate); \ | 7231 i::HandleScope scope(isolate); \ |
7232 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); \ | 7232 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); \ |
7233 error = *isolate->factory()->New##NAME(message); \ | 7233 error = *isolate->factory()->NewError("$" #NAME, message); \ |
7234 } \ | 7234 } \ |
7235 i::Handle<i::Object> result(error, isolate); \ | 7235 i::Handle<i::Object> result(error, isolate); \ |
7236 return Utils::ToLocal(result); \ | 7236 return Utils::ToLocal(result); \ |
7237 } | 7237 } |
7238 | 7238 |
7239 DEFINE_ERROR(RangeError) | 7239 DEFINE_ERROR(RangeError) |
7240 DEFINE_ERROR(ReferenceError) | 7240 DEFINE_ERROR(ReferenceError) |
7241 DEFINE_ERROR(SyntaxError) | 7241 DEFINE_ERROR(SyntaxError) |
7242 DEFINE_ERROR(TypeError) | 7242 DEFINE_ERROR(TypeError) |
7243 DEFINE_ERROR(Error) | 7243 DEFINE_ERROR(Error) |
7244 | 7244 |
7245 #undef DEFINE_ERROR | 7245 #undef DEFINE_ERROR |
7246 | 7246 |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8035 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8035 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8036 Address callback_address = | 8036 Address callback_address = |
8037 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8037 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8038 VMState<EXTERNAL> state(isolate); | 8038 VMState<EXTERNAL> state(isolate); |
8039 ExternalCallbackScope call_scope(isolate, callback_address); | 8039 ExternalCallbackScope call_scope(isolate, callback_address); |
8040 callback(info); | 8040 callback(info); |
8041 } | 8041 } |
8042 | 8042 |
8043 | 8043 |
8044 } } // namespace v8::internal | 8044 } } // namespace v8::internal |
OLD | NEW |