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 5482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5493 } | 5493 } |
5494 | 5494 |
5495 | 5495 |
5496 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) | 5496 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) |
5497 : str_(NULL), length_(0) { | 5497 : str_(NULL), length_(0) { |
5498 i::Isolate* isolate = i::Isolate::Current(); | 5498 i::Isolate* isolate = i::Isolate::Current(); |
5499 if (IsDeadCheck(isolate, "v8::String::Utf8Value::Utf8Value()")) return; | 5499 if (IsDeadCheck(isolate, "v8::String::Utf8Value::Utf8Value()")) return; |
5500 if (obj.IsEmpty()) return; | 5500 if (obj.IsEmpty()) return; |
5501 ENTER_V8(isolate); | 5501 ENTER_V8(isolate); |
5502 i::HandleScope scope(isolate); | 5502 i::HandleScope scope(isolate); |
| 5503 TryCatch try_catch; |
5503 Handle<String> str = obj->ToString(); | 5504 Handle<String> str = obj->ToString(); |
5504 if (str.IsEmpty()) return; | 5505 if (str.IsEmpty()) return; |
5505 i::Handle<i::String> i_str = Utils::OpenHandle(*str); | 5506 i::Handle<i::String> i_str = Utils::OpenHandle(*str); |
5506 length_ = i::Utf8Length(i_str); | 5507 length_ = i::Utf8Length(i_str); |
5507 str_ = i::NewArray<char>(length_ + 1); | 5508 str_ = i::NewArray<char>(length_ + 1); |
5508 str->WriteUtf8(str_); | 5509 str->WriteUtf8(str_); |
5509 } | 5510 } |
5510 | 5511 |
5511 | 5512 |
5512 String::Utf8Value::~Utf8Value() { | 5513 String::Utf8Value::~Utf8Value() { |
5513 i::DeleteArray(str_); | 5514 i::DeleteArray(str_); |
5514 } | 5515 } |
5515 | 5516 |
5516 | 5517 |
5517 String::AsciiValue::AsciiValue(v8::Handle<v8::Value> obj) | 5518 String::AsciiValue::AsciiValue(v8::Handle<v8::Value> obj) |
5518 : str_(NULL), length_(0) { | 5519 : str_(NULL), length_(0) { |
5519 i::Isolate* isolate = i::Isolate::Current(); | 5520 i::Isolate* isolate = i::Isolate::Current(); |
5520 if (IsDeadCheck(isolate, "v8::String::AsciiValue::AsciiValue()")) return; | 5521 if (IsDeadCheck(isolate, "v8::String::AsciiValue::AsciiValue()")) return; |
5521 if (obj.IsEmpty()) return; | 5522 if (obj.IsEmpty()) return; |
5522 ENTER_V8(isolate); | 5523 ENTER_V8(isolate); |
5523 i::HandleScope scope(isolate); | 5524 i::HandleScope scope(isolate); |
| 5525 TryCatch try_catch; |
5524 Handle<String> str = obj->ToString(); | 5526 Handle<String> str = obj->ToString(); |
5525 if (str.IsEmpty()) return; | 5527 if (str.IsEmpty()) return; |
5526 length_ = str->Length(); | 5528 length_ = str->Length(); |
5527 str_ = i::NewArray<char>(length_ + 1); | 5529 str_ = i::NewArray<char>(length_ + 1); |
5528 str->WriteAscii(str_); | 5530 str->WriteAscii(str_); |
5529 } | 5531 } |
5530 | 5532 |
5531 | 5533 |
5532 String::AsciiValue::~AsciiValue() { | 5534 String::AsciiValue::~AsciiValue() { |
5533 i::DeleteArray(str_); | 5535 i::DeleteArray(str_); |
5534 } | 5536 } |
5535 | 5537 |
5536 | 5538 |
5537 String::Value::Value(v8::Handle<v8::Value> obj) | 5539 String::Value::Value(v8::Handle<v8::Value> obj) |
5538 : str_(NULL), length_(0) { | 5540 : str_(NULL), length_(0) { |
5539 i::Isolate* isolate = i::Isolate::Current(); | 5541 i::Isolate* isolate = i::Isolate::Current(); |
5540 if (IsDeadCheck(isolate, "v8::String::Value::Value()")) return; | 5542 if (IsDeadCheck(isolate, "v8::String::Value::Value()")) return; |
5541 if (obj.IsEmpty()) return; | 5543 if (obj.IsEmpty()) return; |
5542 ENTER_V8(isolate); | 5544 ENTER_V8(isolate); |
5543 i::HandleScope scope(isolate); | 5545 i::HandleScope scope(isolate); |
| 5546 TryCatch try_catch; |
5544 Handle<String> str = obj->ToString(); | 5547 Handle<String> str = obj->ToString(); |
5545 if (str.IsEmpty()) return; | 5548 if (str.IsEmpty()) return; |
5546 length_ = str->Length(); | 5549 length_ = str->Length(); |
5547 str_ = i::NewArray<uint16_t>(length_ + 1); | 5550 str_ = i::NewArray<uint16_t>(length_ + 1); |
5548 str->Write(str_); | 5551 str->Write(str_); |
5549 } | 5552 } |
5550 | 5553 |
5551 | 5554 |
5552 String::Value::~Value() { | 5555 String::Value::~Value() { |
5553 i::DeleteArray(str_); | 5556 i::DeleteArray(str_); |
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6574 | 6577 |
6575 v->VisitPointers(blocks_.first(), first_block_limit_); | 6578 v->VisitPointers(blocks_.first(), first_block_limit_); |
6576 | 6579 |
6577 for (int i = 1; i < blocks_.length(); i++) { | 6580 for (int i = 1; i < blocks_.length(); i++) { |
6578 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6581 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
6579 } | 6582 } |
6580 } | 6583 } |
6581 | 6584 |
6582 | 6585 |
6583 } } // namespace v8::internal | 6586 } } // namespace v8::internal |
OLD | NEW |