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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 int dep_count, | 534 int dep_count, |
535 const char** deps, | 535 const char** deps, |
536 int source_length) | 536 int source_length) |
537 : name_(name), | 537 : name_(name), |
538 source_length_(source_length >= 0 ? | 538 source_length_(source_length >= 0 ? |
539 source_length : | 539 source_length : |
540 (source ? static_cast<int>(strlen(source)) : 0)), | 540 (source ? static_cast<int>(strlen(source)) : 0)), |
541 source_(source, source_length_), | 541 source_(source, source_length_), |
542 dep_count_(dep_count), | 542 dep_count_(dep_count), |
543 deps_(deps), | 543 deps_(deps), |
544 auto_enable_(false) { } | 544 auto_enable_(false) { |
| 545 CHECK(source != NULL || source_length_ == 0); |
| 546 } |
545 | 547 |
546 | 548 |
547 v8::Handle<Primitive> Undefined() { | 549 v8::Handle<Primitive> Undefined() { |
548 i::Isolate* isolate = i::Isolate::Current(); | 550 i::Isolate* isolate = i::Isolate::Current(); |
549 if (!EnsureInitializedForIsolate(isolate, "v8::Undefined()")) { | 551 if (!EnsureInitializedForIsolate(isolate, "v8::Undefined()")) { |
550 return v8::Handle<v8::Primitive>(); | 552 return v8::Handle<v8::Primitive>(); |
551 } | 553 } |
552 return v8::Handle<Primitive>(ToApi<Primitive>( | 554 return v8::Handle<Primitive>(ToApi<Primitive>( |
553 isolate->factory()->undefined_value())); | 555 isolate->factory()->undefined_value())); |
554 } | 556 } |
(...skipping 2840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3395 } | 3397 } |
3396 | 3398 |
3397 } // namespace | 3399 } // namespace |
3398 | 3400 |
3399 | 3401 |
3400 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) { | 3402 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) { |
3401 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3403 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3402 ON_BAILOUT(isolate, "v8::SetElementsToPixelData()", return); | 3404 ON_BAILOUT(isolate, "v8::SetElementsToPixelData()", return); |
3403 ENTER_V8(isolate); | 3405 ENTER_V8(isolate); |
3404 i::HandleScope scope(isolate); | 3406 i::HandleScope scope(isolate); |
3405 if (!ApiCheck(length <= i::ExternalPixelArray::kMaxLength, | 3407 if (!ApiCheck(length >= 0 && length <= i::ExternalPixelArray::kMaxLength, |
3406 "v8::Object::SetIndexedPropertiesToPixelData()", | 3408 "v8::Object::SetIndexedPropertiesToPixelData()", |
3407 "length exceeds max acceptable value")) { | 3409 "length exceeds max acceptable value")) { |
3408 return; | 3410 return; |
3409 } | 3411 } |
3410 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3412 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
3411 if (!ApiCheck(!self->IsJSArray(), | 3413 if (!ApiCheck(!self->IsJSArray(), |
3412 "v8::Object::SetIndexedPropertiesToPixelData()", | 3414 "v8::Object::SetIndexedPropertiesToPixelData()", |
3413 "JSArray is not supported")) { | 3415 "JSArray is not supported")) { |
3414 return; | 3416 return; |
3415 } | 3417 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3451 | 3453 |
3452 | 3454 |
3453 void v8::Object::SetIndexedPropertiesToExternalArrayData( | 3455 void v8::Object::SetIndexedPropertiesToExternalArrayData( |
3454 void* data, | 3456 void* data, |
3455 ExternalArrayType array_type, | 3457 ExternalArrayType array_type, |
3456 int length) { | 3458 int length) { |
3457 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3459 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3458 ON_BAILOUT(isolate, "v8::SetIndexedPropertiesToExternalArrayData()", return); | 3460 ON_BAILOUT(isolate, "v8::SetIndexedPropertiesToExternalArrayData()", return); |
3459 ENTER_V8(isolate); | 3461 ENTER_V8(isolate); |
3460 i::HandleScope scope(isolate); | 3462 i::HandleScope scope(isolate); |
3461 if (!ApiCheck(length <= i::ExternalArray::kMaxLength, | 3463 if (!ApiCheck(length >= 0 && length <= i::ExternalArray::kMaxLength, |
3462 "v8::Object::SetIndexedPropertiesToExternalArrayData()", | 3464 "v8::Object::SetIndexedPropertiesToExternalArrayData()", |
3463 "length exceeds max acceptable value")) { | 3465 "length exceeds max acceptable value")) { |
3464 return; | 3466 return; |
3465 } | 3467 } |
3466 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3468 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
3467 if (!ApiCheck(!self->IsJSArray(), | 3469 if (!ApiCheck(!self->IsJSArray(), |
3468 "v8::Object::SetIndexedPropertiesToExternalArrayData()", | 3470 "v8::Object::SetIndexedPropertiesToExternalArrayData()", |
3469 "JSArray is not supported")) { | 3471 "JSArray is not supported")) { |
3470 return; | 3472 return; |
3471 } | 3473 } |
(...skipping 3080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6552 | 6554 |
6553 v->VisitPointers(blocks_.first(), first_block_limit_); | 6555 v->VisitPointers(blocks_.first(), first_block_limit_); |
6554 | 6556 |
6555 for (int i = 1; i < blocks_.length(); i++) { | 6557 for (int i = 1; i < blocks_.length(); i++) { |
6556 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6558 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
6557 } | 6559 } |
6558 } | 6560 } |
6559 | 6561 |
6560 | 6562 |
6561 } } // namespace v8::internal | 6563 } } // namespace v8::internal |
OLD | NEW |