Commit 5560d277 authored by antonm@chromium.org's avatar antonm@chromium.org

Move implementation of Integer::NewFromUnsigned into api.cc.

Review URL: http://codereview.chromium.org/269105

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3084 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5e4ad025
......@@ -1069,7 +1069,7 @@ class V8EXPORT Number : public Primitive {
class V8EXPORT Integer : public Number {
public:
static Local<Integer> New(int32_t value);
static inline Local<Integer> NewFromUnsigned(uint32_t value);
static Local<Integer> NewFromUnsigned(uint32_t value);
int64_t Value() const;
static inline Integer* Cast(v8::Value* obj);
private:
......@@ -3069,15 +3069,6 @@ Number* Number::Cast(v8::Value* value) {
}
Local<Integer> Integer::NewFromUnsigned(uint32_t value) {
bool fits_into_int32_t = (value & (1 << 31)) == 0;
if (fits_into_int32_t) {
return Integer::New(static_cast<int32_t>(value));
}
return Local<Integer>::Cast(Number::New(value));
}
Integer* Integer::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
......
......@@ -3241,6 +3241,17 @@ Local<Integer> v8::Integer::New(int32_t value) {
}
Local<Integer> Integer::NewFromUnsigned(uint32_t value) {
bool fits_into_int32_t = (value & (1 << 31)) == 0;
if (fits_into_int32_t) {
return Integer::New(static_cast<int32_t>(value));
}
ENTER_V8;
i::Handle<i::Object> result = i::Factory::NewNumber(value);
return Utils::IntegerToLocal(result);
}
void V8::IgnoreOutOfMemoryException() {
thread_local.set_ignore_out_of_memory(true);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment