Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1689)

Side by Side Diff: src/accessors.cc

Issue 316173002: Handle "//# sourceURL" comments in the Parser instead of the JS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: yet another trivial rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/accessors.h ('k') | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 STATIC_ASCII_VECTOR("line_ends"))); 579 STATIC_ASCII_VECTOR("line_ends")));
580 return MakeAccessor(isolate, 580 return MakeAccessor(isolate,
581 name, 581 name,
582 &ScriptLineEndsGetter, 582 &ScriptLineEndsGetter,
583 &ScriptLineEndsSetter, 583 &ScriptLineEndsSetter,
584 attributes); 584 attributes);
585 } 585 }
586 586
587 587
588 // 588 //
589 // Accessors::ScriptSourceUrl
590 //
591
592
593 void Accessors::ScriptSourceUrlGetter(
594 v8::Local<v8::String> name,
595 const v8::PropertyCallbackInfo<v8::Value>& info) {
596 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
597 DisallowHeapAllocation no_allocation;
598 HandleScope scope(isolate);
599 Object* object = *Utils::OpenHandle(*info.This());
600 Object* url = Script::cast(JSValue::cast(object)->value())->source_url();
601 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(url, isolate)));
602 }
603
604
605 void Accessors::ScriptSourceUrlSetter(
606 v8::Local<v8::String> name,
607 v8::Local<v8::Value> value,
608 const v8::PropertyCallbackInfo<void>& info) {
609 UNREACHABLE();
610 }
611
612
613 Handle<AccessorInfo> Accessors::ScriptSourceUrlInfo(
614 Isolate* isolate, PropertyAttributes attributes) {
615 return MakeAccessor(isolate,
616 isolate->factory()->source_url_string(),
617 &ScriptSourceUrlGetter,
618 &ScriptSourceUrlSetter,
619 attributes);
620 }
621
622
623 //
624 // Accessors::ScriptSourceMappingUrl
625 //
626
627
628 void Accessors::ScriptSourceMappingUrlGetter(
629 v8::Local<v8::String> name,
630 const v8::PropertyCallbackInfo<v8::Value>& info) {
631 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
632 DisallowHeapAllocation no_allocation;
633 HandleScope scope(isolate);
634 Object* object = *Utils::OpenHandle(*info.This());
635 Object* url =
636 Script::cast(JSValue::cast(object)->value())->source_mapping_url();
637 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(url, isolate)));
638 }
639
640
641 void Accessors::ScriptSourceMappingUrlSetter(
642 v8::Local<v8::String> name,
643 v8::Local<v8::Value> value,
644 const v8::PropertyCallbackInfo<void>& info) {
645 UNREACHABLE();
646 }
647
648
649 Handle<AccessorInfo> Accessors::ScriptSourceMappingUrlInfo(
650 Isolate* isolate, PropertyAttributes attributes) {
651 return MakeAccessor(isolate,
652 isolate->factory()->source_mapping_url_string(),
653 &ScriptSourceMappingUrlGetter,
654 &ScriptSourceMappingUrlSetter,
655 attributes);
656 }
657
658
659 //
589 // Accessors::ScriptGetContextData 660 // Accessors::ScriptGetContextData
590 // 661 //
591 662
592 663
593 void Accessors::ScriptContextDataGetter( 664 void Accessors::ScriptContextDataGetter(
594 v8::Local<v8::String> name, 665 v8::Local<v8::String> name,
595 const v8::PropertyCallbackInfo<v8::Value>& info) { 666 const v8::PropertyCallbackInfo<v8::Value>& info) {
596 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); 667 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
597 DisallowHeapAllocation no_allocation; 668 DisallowHeapAllocation no_allocation;
598 HandleScope scope(isolate); 669 HandleScope scope(isolate);
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 info->set_data(Smi::FromInt(index)); 1422 info->set_data(Smi::FromInt(index));
1352 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 1423 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1353 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 1424 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1354 info->set_getter(*getter); 1425 info->set_getter(*getter);
1355 if (!(attributes & ReadOnly)) info->set_setter(*setter); 1426 if (!(attributes & ReadOnly)) info->set_setter(*setter);
1356 return info; 1427 return info;
1357 } 1428 }
1358 1429
1359 1430
1360 } } // namespace v8::internal 1431 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698