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

Side by Side Diff: src/api.cc

Issue 1003663002: Add Cast() for Int32 and Uint32 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « include/v8.h ('k') | no next file » | 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 2955 matching lines...) Expand 10 before | Expand all | Expand 10 after
2966 2966
2967 2967
2968 void v8::Integer::CheckCast(v8::Value* that) { 2968 void v8::Integer::CheckCast(v8::Value* that) {
2969 i::Handle<i::Object> obj = Utils::OpenHandle(that); 2969 i::Handle<i::Object> obj = Utils::OpenHandle(that);
2970 Utils::ApiCheck(obj->IsNumber(), 2970 Utils::ApiCheck(obj->IsNumber(),
2971 "v8::Integer::Cast()", 2971 "v8::Integer::Cast()",
2972 "Could not convert to number"); 2972 "Could not convert to number");
2973 } 2973 }
2974 2974
2975 2975
2976 void v8::Int32::CheckCast(v8::Value* that) {
2977 Utils::ApiCheck(that->IsInt32(), "v8::Int32::Cast()",
2978 "Could not convert to 32-bit signed integer");
2979 }
2980
2981
2982 void v8::Uint32::CheckCast(v8::Value* that) {
2983 Utils::ApiCheck(that->IsUint32(), "v8::Uint32::Cast()",
2984 "Could not convert to 32-bit unsigned integer");
2985 }
2986
2987
2976 void v8::Array::CheckCast(Value* that) { 2988 void v8::Array::CheckCast(Value* that) {
2977 i::Handle<i::Object> obj = Utils::OpenHandle(that); 2989 i::Handle<i::Object> obj = Utils::OpenHandle(that);
2978 Utils::ApiCheck(obj->IsJSArray(), 2990 Utils::ApiCheck(obj->IsJSArray(),
2979 "v8::Array::Cast()", 2991 "v8::Array::Cast()",
2980 "Could not convert to array"); 2992 "Could not convert to array");
2981 } 2993 }
2982 2994
2983 2995
2984 void v8::Promise::CheckCast(Value* that) { 2996 void v8::Promise::CheckCast(Value* that) {
2985 Utils::ApiCheck(that->IsPromise(), 2997 Utils::ApiCheck(that->IsPromise(),
(...skipping 4990 matching lines...) Expand 10 before | Expand all | Expand 10 after
7976 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7988 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7977 Address callback_address = 7989 Address callback_address =
7978 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7990 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7979 VMState<EXTERNAL> state(isolate); 7991 VMState<EXTERNAL> state(isolate);
7980 ExternalCallbackScope call_scope(isolate, callback_address); 7992 ExternalCallbackScope call_scope(isolate, callback_address);
7981 callback(info); 7993 callback(info);
7982 } 7994 }
7983 7995
7984 7996
7985 } } // namespace v8::internal 7997 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698