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 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2576 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2576 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
2577 if (obj->IsBoolean()) { | 2577 if (obj->IsBoolean()) { |
2578 return Local<Boolean>(ToApi<Boolean>(obj)); | 2578 return Local<Boolean>(ToApi<Boolean>(obj)); |
2579 } else { | 2579 } else { |
2580 i::Isolate* isolate = i::Isolate::Current(); | 2580 i::Isolate* isolate = i::Isolate::Current(); |
2581 if (IsDeadCheck(isolate, "v8::Value::ToBoolean()")) { | 2581 if (IsDeadCheck(isolate, "v8::Value::ToBoolean()")) { |
2582 return Local<Boolean>(); | 2582 return Local<Boolean>(); |
2583 } | 2583 } |
2584 LOG_API(isolate, "ToBoolean"); | 2584 LOG_API(isolate, "ToBoolean"); |
2585 ENTER_V8(isolate); | 2585 ENTER_V8(isolate); |
2586 i::Handle<i::Object> val = i::Execution::ToBoolean(isolate, obj); | 2586 i::Handle<i::Object> val = |
| 2587 isolate->factory()->ToBoolean(obj->BooleanValue()); |
2587 return Local<Boolean>(ToApi<Boolean>(val)); | 2588 return Local<Boolean>(ToApi<Boolean>(val)); |
2588 } | 2589 } |
2589 } | 2590 } |
2590 | 2591 |
2591 | 2592 |
2592 Local<Number> Value::ToNumber() const { | 2593 Local<Number> Value::ToNumber() const { |
2593 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2594 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
2594 i::Handle<i::Object> num; | 2595 i::Handle<i::Object> num; |
2595 if (obj->IsNumber()) { | 2596 if (obj->IsNumber()) { |
2596 num = obj; | 2597 num = obj; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2732 void v8::RegExp::CheckCast(v8::Value* that) { | 2733 void v8::RegExp::CheckCast(v8::Value* that) { |
2733 if (IsDeadCheck(i::Isolate::Current(), "v8::RegExp::Cast()")) return; | 2734 if (IsDeadCheck(i::Isolate::Current(), "v8::RegExp::Cast()")) return; |
2734 i::Handle<i::Object> obj = Utils::OpenHandle(that); | 2735 i::Handle<i::Object> obj = Utils::OpenHandle(that); |
2735 ApiCheck(obj->IsJSRegExp(), | 2736 ApiCheck(obj->IsJSRegExp(), |
2736 "v8::RegExp::Cast()", | 2737 "v8::RegExp::Cast()", |
2737 "Could not convert to regular expression"); | 2738 "Could not convert to regular expression"); |
2738 } | 2739 } |
2739 | 2740 |
2740 | 2741 |
2741 bool Value::BooleanValue() const { | 2742 bool Value::BooleanValue() const { |
2742 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2743 return Utils::OpenHandle(this)->BooleanValue(); |
2743 if (obj->IsBoolean()) { | |
2744 return obj->IsTrue(); | |
2745 } else { | |
2746 i::Isolate* isolate = i::Isolate::Current(); | |
2747 if (IsDeadCheck(isolate, "v8::Value::BooleanValue()")) return false; | |
2748 LOG_API(isolate, "BooleanValue"); | |
2749 ENTER_V8(isolate); | |
2750 i::Handle<i::Object> value = i::Execution::ToBoolean(isolate, obj); | |
2751 return value->IsTrue(); | |
2752 } | |
2753 } | 2744 } |
2754 | 2745 |
2755 | 2746 |
2756 double Value::NumberValue() const { | 2747 double Value::NumberValue() const { |
2757 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2748 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
2758 i::Handle<i::Object> num; | 2749 i::Handle<i::Object> num; |
2759 if (obj->IsNumber()) { | 2750 if (obj->IsNumber()) { |
2760 num = obj; | 2751 num = obj; |
2761 } else { | 2752 } else { |
2762 i::Isolate* isolate = i::Isolate::Current(); | 2753 i::Isolate* isolate = i::Isolate::Current(); |
(...skipping 4310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7073 | 7064 |
7074 v->VisitPointers(blocks_.first(), first_block_limit_); | 7065 v->VisitPointers(blocks_.first(), first_block_limit_); |
7075 | 7066 |
7076 for (int i = 1; i < blocks_.length(); i++) { | 7067 for (int i = 1; i < blocks_.length(); i++) { |
7077 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 7068 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
7078 } | 7069 } |
7079 } | 7070 } |
7080 | 7071 |
7081 | 7072 |
7082 } } // namespace v8::internal | 7073 } } // namespace v8::internal |
OLD | NEW |