OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/v8.h" | 5 #include "src/v8.h" |
6 #include "src/accessors.h" | 6 #include "src/accessors.h" |
7 | 7 |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/contexts.h" | 9 #include "src/contexts.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 STATIC_ASCII_VECTOR("line_ends"))); | 580 STATIC_ASCII_VECTOR("line_ends"))); |
581 return MakeAccessor(isolate, | 581 return MakeAccessor(isolate, |
582 name, | 582 name, |
583 &ScriptLineEndsGetter, | 583 &ScriptLineEndsGetter, |
584 &ScriptLineEndsSetter, | 584 &ScriptLineEndsSetter, |
585 attributes); | 585 attributes); |
586 } | 586 } |
587 | 587 |
588 | 588 |
589 // | 589 // |
| 590 // Accessors::ScriptSourceUrl |
| 591 // |
| 592 |
| 593 |
| 594 void Accessors::ScriptSourceUrlGetter( |
| 595 v8::Local<v8::String> name, |
| 596 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 597 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
| 598 DisallowHeapAllocation no_allocation; |
| 599 HandleScope scope(isolate); |
| 600 Object* object = *Utils::OpenHandle(*info.This()); |
| 601 Object* url = Script::cast(JSValue::cast(object)->value())->source_url(); |
| 602 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(url, isolate))); |
| 603 } |
| 604 |
| 605 |
| 606 void Accessors::ScriptSourceUrlSetter( |
| 607 v8::Local<v8::String> name, |
| 608 v8::Local<v8::Value> value, |
| 609 const v8::PropertyCallbackInfo<void>& info) { |
| 610 UNREACHABLE(); |
| 611 } |
| 612 |
| 613 |
| 614 Handle<AccessorInfo> Accessors::ScriptSourceUrlInfo( |
| 615 Isolate* isolate, PropertyAttributes attributes) { |
| 616 return MakeAccessor(isolate, |
| 617 isolate->factory()->source_url_string(), |
| 618 &ScriptSourceUrlGetter, |
| 619 &ScriptSourceUrlSetter, |
| 620 attributes); |
| 621 } |
| 622 |
| 623 |
| 624 // |
| 625 // Accessors::ScriptSourceMappingUrl |
| 626 // |
| 627 |
| 628 |
| 629 void Accessors::ScriptSourceMappingUrlGetter( |
| 630 v8::Local<v8::String> name, |
| 631 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 632 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
| 633 DisallowHeapAllocation no_allocation; |
| 634 HandleScope scope(isolate); |
| 635 Object* object = *Utils::OpenHandle(*info.This()); |
| 636 Object* url = |
| 637 Script::cast(JSValue::cast(object)->value())->source_mapping_url(); |
| 638 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(url, isolate))); |
| 639 } |
| 640 |
| 641 |
| 642 void Accessors::ScriptSourceMappingUrlSetter( |
| 643 v8::Local<v8::String> name, |
| 644 v8::Local<v8::Value> value, |
| 645 const v8::PropertyCallbackInfo<void>& info) { |
| 646 UNREACHABLE(); |
| 647 } |
| 648 |
| 649 |
| 650 Handle<AccessorInfo> Accessors::ScriptSourceMappingUrlInfo( |
| 651 Isolate* isolate, PropertyAttributes attributes) { |
| 652 return MakeAccessor(isolate, |
| 653 isolate->factory()->source_mapping_url_string(), |
| 654 &ScriptSourceMappingUrlGetter, |
| 655 &ScriptSourceMappingUrlSetter, |
| 656 attributes); |
| 657 } |
| 658 |
| 659 |
| 660 // |
590 // Accessors::ScriptGetContextData | 661 // Accessors::ScriptGetContextData |
591 // | 662 // |
592 | 663 |
593 | 664 |
594 void Accessors::ScriptContextDataGetter( | 665 void Accessors::ScriptContextDataGetter( |
595 v8::Local<v8::String> name, | 666 v8::Local<v8::String> name, |
596 const v8::PropertyCallbackInfo<v8::Value>& info) { | 667 const v8::PropertyCallbackInfo<v8::Value>& info) { |
597 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 668 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
598 DisallowHeapAllocation no_allocation; | 669 DisallowHeapAllocation no_allocation; |
599 HandleScope scope(isolate); | 670 HandleScope scope(isolate); |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 info->set_data(Smi::FromInt(index)); | 1423 info->set_data(Smi::FromInt(index)); |
1353 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1424 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1354 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1425 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1355 info->set_getter(*getter); | 1426 info->set_getter(*getter); |
1356 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1427 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1357 return info; | 1428 return info; |
1358 } | 1429 } |
1359 | 1430 |
1360 | 1431 |
1361 } } // namespace v8::internal | 1432 } } // namespace v8::internal |
OLD | NEW |