OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4682 int f = FastD2IChecked(f_number); | 4682 int f = FastD2IChecked(f_number); |
4683 RUNTIME_ASSERT(f >= 1 && f <= 21); | 4683 RUNTIME_ASSERT(f >= 1 && f <= 21); |
4684 char* str = DoubleToPrecisionCString(value, f); | 4684 char* str = DoubleToPrecisionCString(value, f); |
4685 MaybeObject* res = | 4685 MaybeObject* res = |
4686 isolate->heap()->AllocateStringFromOneByte(CStrVector(str)); | 4686 isolate->heap()->AllocateStringFromOneByte(CStrVector(str)); |
4687 DeleteArray(str); | 4687 DeleteArray(str); |
4688 return res; | 4688 return res; |
4689 } | 4689 } |
4690 | 4690 |
4691 | 4691 |
| 4692 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsValidSmi) { |
| 4693 HandleScope shs(isolate); |
| 4694 ASSERT(args.length() == 1); |
| 4695 |
| 4696 CONVERT_NUMBER_CHECKED(int32_t, number, Int32, args[0]); |
| 4697 if (Smi::IsValid(number)) { |
| 4698 return isolate->heap()->true_value(); |
| 4699 } else { |
| 4700 return isolate->heap()->false_value(); |
| 4701 } |
| 4702 } |
| 4703 |
| 4704 |
4692 // Returns a single character string where first character equals | 4705 // Returns a single character string where first character equals |
4693 // string->Get(index). | 4706 // string->Get(index). |
4694 static Handle<Object> GetCharAt(Handle<String> string, uint32_t index) { | 4707 static Handle<Object> GetCharAt(Handle<String> string, uint32_t index) { |
4695 if (index < static_cast<uint32_t>(string->length())) { | 4708 if (index < static_cast<uint32_t>(string->length())) { |
4696 string->TryFlatten(); | 4709 string->TryFlatten(); |
4697 return LookupSingleCharacterStringFromCode( | 4710 return LookupSingleCharacterStringFromCode( |
4698 string->GetIsolate(), | 4711 string->GetIsolate(), |
4699 string->Get(index)); | 4712 string->Get(index)); |
4700 } | 4713 } |
4701 return Execution::CharAt(string, index); | 4714 return Execution::CharAt(string, index); |
(...skipping 9776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14478 // Handle last resort GC and make sure to allow future allocations | 14491 // Handle last resort GC and make sure to allow future allocations |
14479 // to grow the heap without causing GCs (if possible). | 14492 // to grow the heap without causing GCs (if possible). |
14480 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14493 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14481 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14494 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14482 "Runtime::PerformGC"); | 14495 "Runtime::PerformGC"); |
14483 } | 14496 } |
14484 } | 14497 } |
14485 | 14498 |
14486 | 14499 |
14487 } } // namespace v8::internal | 14500 } } // namespace v8::internal |
OLD | NEW |