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

Side by Side Diff: src/api.cc

Issue 269105: Move implementation of Integer::NewFromUnsigned into api.cc. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 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 | Annotate | Revision Log
« 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 3223 matching lines...) Expand 10 before | Expand all | Expand 10 after
3234 EnsureInitialized("v8::Integer::New()"); 3234 EnsureInitialized("v8::Integer::New()");
3235 if (i::Smi::IsValid(value)) { 3235 if (i::Smi::IsValid(value)) {
3236 return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value))); 3236 return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value)));
3237 } 3237 }
3238 ENTER_V8; 3238 ENTER_V8;
3239 i::Handle<i::Object> result = i::Factory::NewNumber(value); 3239 i::Handle<i::Object> result = i::Factory::NewNumber(value);
3240 return Utils::IntegerToLocal(result); 3240 return Utils::IntegerToLocal(result);
3241 } 3241 }
3242 3242
3243 3243
3244 Local<Integer> Integer::NewFromUnsigned(uint32_t value) {
3245 bool fits_into_int32_t = (value & (1 << 31)) == 0;
3246 if (fits_into_int32_t) {
3247 return Integer::New(static_cast<int32_t>(value));
3248 }
3249 ENTER_V8;
3250 i::Handle<i::Object> result = i::Factory::NewNumber(value);
3251 return Utils::IntegerToLocal(result);
3252 }
3253
3254
3244 void V8::IgnoreOutOfMemoryException() { 3255 void V8::IgnoreOutOfMemoryException() {
3245 thread_local.set_ignore_out_of_memory(true); 3256 thread_local.set_ignore_out_of_memory(true);
3246 } 3257 }
3247 3258
3248 3259
3249 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) { 3260 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) {
3250 EnsureInitialized("v8::V8::AddMessageListener()"); 3261 EnsureInitialized("v8::V8::AddMessageListener()");
3251 ON_BAILOUT("v8::V8::AddMessageListener()", return false); 3262 ON_BAILOUT("v8::V8::AddMessageListener()", return false);
3252 ENTER_V8; 3263 ENTER_V8;
3253 HandleScope scope; 3264 HandleScope scope;
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
3792 3803
3793 3804
3794 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 3805 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
3795 HandleScopeImplementer* thread_local = 3806 HandleScopeImplementer* thread_local =
3796 reinterpret_cast<HandleScopeImplementer*>(storage); 3807 reinterpret_cast<HandleScopeImplementer*>(storage);
3797 thread_local->IterateThis(v); 3808 thread_local->IterateThis(v);
3798 return storage + ArchiveSpacePerThread(); 3809 return storage + ArchiveSpacePerThread();
3799 } 3810 }
3800 3811
3801 } } // namespace v8::internal 3812 } } // 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