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

Side by Side Diff: src/factory.cc

Issue 259173003: Kiss goodbye to MaybeObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase + addressed comments Created 6 years, 7 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 | « src/execution.cc ('k') | src/gdb-jit.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "factory.h" 5 #include "factory.h"
6 6
7 #include "conversions.h" 7 #include "conversions.h"
8 #include "isolate-inl.h" 8 #include "isolate-inl.h"
9 #include "macro-assembler.h" 9 #include "macro-assembler.h"
10 10
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 1062
1063 Handle<Object> Factory::NewNumberFromInt(int32_t value, 1063 Handle<Object> Factory::NewNumberFromInt(int32_t value,
1064 PretenureFlag pretenure) { 1064 PretenureFlag pretenure) {
1065 if (Smi::IsValid(value)) return handle(Smi::FromInt(value), isolate()); 1065 if (Smi::IsValid(value)) return handle(Smi::FromInt(value), isolate());
1066 // Bypass NumberFromDouble to avoid various redundant checks. 1066 // Bypass NumberFromDouble to avoid various redundant checks.
1067 return NewHeapNumber(FastI2D(value), pretenure); 1067 return NewHeapNumber(FastI2D(value), pretenure);
1068 } 1068 }
1069 1069
1070 1070
1071 Handle<Object> Factory::NewNumberFromUint(uint32_t value, 1071 Handle<Object> Factory::NewNumberFromUint(uint32_t value,
1072 PretenureFlag pretenure) { 1072 PretenureFlag pretenure) {
1073 CALL_HEAP_FUNCTION( 1073 int32_t int32v = static_cast<int32_t>(value);
1074 isolate(), 1074 if (int32v >= 0 && Smi::IsValid(int32v)) {
1075 isolate()->heap()->NumberFromUint32(value, pretenure), Object); 1075 return handle(Smi::FromInt(int32v), isolate());
1076 }
1077 return NewHeapNumber(FastUI2D(value), pretenure);
1076 } 1078 }
1077 1079
1078 1080
1079 Handle<HeapNumber> Factory::NewHeapNumber(double value, 1081 Handle<HeapNumber> Factory::NewHeapNumber(double value,
1080 PretenureFlag pretenure) { 1082 PretenureFlag pretenure) {
1081 CALL_HEAP_FUNCTION( 1083 CALL_HEAP_FUNCTION(
1082 isolate(), 1084 isolate(),
1083 isolate()->heap()->AllocateHeapNumber(value, pretenure), HeapNumber); 1085 isolate()->heap()->AllocateHeapNumber(value, pretenure), HeapNumber);
1084 } 1086 }
1085 1087
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 if (!self_ref.is_null()) *(self_ref.location()) = *code; 1411 if (!self_ref.is_null()) *(self_ref.location()) = *code;
1410 1412
1411 // Migrate generated code. 1413 // Migrate generated code.
1412 // The generated code can contain Object** values (typically from handles) 1414 // The generated code can contain Object** values (typically from handles)
1413 // that are dereferenced during the copy to point directly to the actual heap 1415 // that are dereferenced during the copy to point directly to the actual heap
1414 // objects. These pointers can include references to the code object itself, 1416 // objects. These pointers can include references to the code object itself,
1415 // through the self_reference parameter. 1417 // through the self_reference parameter.
1416 code->CopyFrom(desc); 1418 code->CopyFrom(desc);
1417 1419
1418 #ifdef VERIFY_HEAP 1420 #ifdef VERIFY_HEAP
1419 if (FLAG_verify_heap) { 1421 if (FLAG_verify_heap) code->ObjectVerify();
1420 code->Verify();
1421 }
1422 #endif 1422 #endif
1423 return code; 1423 return code;
1424 } 1424 }
1425 1425
1426 1426
1427 Handle<Code> Factory::CopyCode(Handle<Code> code) { 1427 Handle<Code> Factory::CopyCode(Handle<Code> code) {
1428 CALL_HEAP_FUNCTION(isolate(), 1428 CALL_HEAP_FUNCTION(isolate(),
1429 isolate()->heap()->CopyCode(*code), 1429 isolate()->heap()->CopyCode(*code),
1430 Code); 1430 Code);
1431 } 1431 }
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 return Handle<Object>::null(); 2349 return Handle<Object>::null();
2350 } 2350 }
2351 2351
2352 2352
2353 Handle<Object> Factory::ToBoolean(bool value) { 2353 Handle<Object> Factory::ToBoolean(bool value) {
2354 return value ? true_value() : false_value(); 2354 return value ? true_value() : false_value();
2355 } 2355 }
2356 2356
2357 2357
2358 } } // namespace v8::internal 2358 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | src/gdb-jit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698