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

Side by Side Diff: src/api.cc

Issue 7889046: Add an optional source length field to the Extension constructor. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 3 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 | « include/v8.h ('k') | src/bootstrapper.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 494
495 void RegisterExtension(Extension* that) { 495 void RegisterExtension(Extension* that) {
496 RegisteredExtension* extension = new RegisteredExtension(that); 496 RegisteredExtension* extension = new RegisteredExtension(that);
497 RegisteredExtension::Register(extension); 497 RegisteredExtension::Register(extension);
498 } 498 }
499 499
500 500
501 Extension::Extension(const char* name, 501 Extension::Extension(const char* name,
502 const char* source, 502 const char* source,
503 int dep_count, 503 int dep_count,
504 const char** deps) 504 const char** deps,
505 int source_length)
505 : name_(name), 506 : name_(name),
506 source_(source), 507 source_length_(source_length >= 0 ?
508 source_length : (source ? strlen(source) : 0)),
509 source_(source, source_length_),
507 dep_count_(dep_count), 510 dep_count_(dep_count),
508 deps_(deps), 511 deps_(deps),
509 auto_enable_(false) { } 512 auto_enable_(false) { }
510 513
511 514
512 v8::Handle<Primitive> Undefined() { 515 v8::Handle<Primitive> Undefined() {
513 i::Isolate* isolate = i::Isolate::Current(); 516 i::Isolate* isolate = i::Isolate::Current();
514 if (!EnsureInitializedForIsolate(isolate, "v8::Undefined()")) { 517 if (!EnsureInitializedForIsolate(isolate, "v8::Undefined()")) {
515 return v8::Handle<v8::Primitive>(); 518 return v8::Handle<v8::Primitive>();
516 } 519 }
(...skipping 3265 matching lines...) Expand 10 before | Expand all | Expand 10 after
3782 if (IsDeadCheck(str->GetIsolate(), "v8::String::IsExternalAscii()")) { 3785 if (IsDeadCheck(str->GetIsolate(), "v8::String::IsExternalAscii()")) {
3783 return false; 3786 return false;
3784 } 3787 }
3785 return i::StringShape(*str).IsExternalAscii(); 3788 return i::StringShape(*str).IsExternalAscii();
3786 } 3789 }
3787 3790
3788 3791
3789 void v8::String::VerifyExternalStringResource( 3792 void v8::String::VerifyExternalStringResource(
3790 v8::String::ExternalStringResource* value) const { 3793 v8::String::ExternalStringResource* value) const {
3791 i::Handle<i::String> str = Utils::OpenHandle(this); 3794 i::Handle<i::String> str = Utils::OpenHandle(this);
3792 v8::String::ExternalStringResource* expected; 3795 const v8::String::ExternalStringResource* expected;
3793 if (i::StringShape(*str).IsExternalTwoByte()) { 3796 if (i::StringShape(*str).IsExternalTwoByte()) {
3794 void* resource = i::Handle<i::ExternalTwoByteString>::cast(str)->resource(); 3797 const void* resource =
3795 expected = reinterpret_cast<ExternalStringResource*>(resource); 3798 i::Handle<i::ExternalTwoByteString>::cast(str)->resource();
3799 expected = reinterpret_cast<const ExternalStringResource*>(resource);
3796 } else { 3800 } else {
3797 expected = NULL; 3801 expected = NULL;
3798 } 3802 }
3799 CHECK_EQ(expected, value); 3803 CHECK_EQ(expected, value);
3800 } 3804 }
3801 3805
3802 3806
3803 v8::String::ExternalAsciiStringResource* 3807 const v8::String::ExternalAsciiStringResource*
3804 v8::String::GetExternalAsciiStringResource() const { 3808 v8::String::GetExternalAsciiStringResource() const {
3805 i::Handle<i::String> str = Utils::OpenHandle(this); 3809 i::Handle<i::String> str = Utils::OpenHandle(this);
3806 if (IsDeadCheck(str->GetIsolate(), 3810 if (IsDeadCheck(str->GetIsolate(),
3807 "v8::String::GetExternalAsciiStringResource()")) { 3811 "v8::String::GetExternalAsciiStringResource()")) {
3808 return NULL; 3812 return NULL;
3809 } 3813 }
3810 if (i::StringShape(*str).IsExternalAscii()) { 3814 if (i::StringShape(*str).IsExternalAscii()) {
3811 void* resource = i::Handle<i::ExternalAsciiString>::cast(str)->resource(); 3815 const void* resource =
3812 return reinterpret_cast<ExternalAsciiStringResource*>(resource); 3816 i::Handle<i::ExternalAsciiString>::cast(str)->resource();
3817 return reinterpret_cast<const ExternalAsciiStringResource*>(resource);
3813 } else { 3818 } else {
3814 return NULL; 3819 return NULL;
3815 } 3820 }
3816 } 3821 }
3817 3822
3818 3823
3819 double Number::Value() const { 3824 double Number::Value() const {
3820 if (IsDeadCheck(i::Isolate::Current(), "v8::Number::Value()")) return 0; 3825 if (IsDeadCheck(i::Isolate::Current(), "v8::Number::Value()")) return 0;
3821 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3826 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3822 return obj->Number(); 3827 return obj->Number();
(...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after
6066 6071
6067 6072
6068 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 6073 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
6069 HandleScopeImplementer* scope_implementer = 6074 HandleScopeImplementer* scope_implementer =
6070 reinterpret_cast<HandleScopeImplementer*>(storage); 6075 reinterpret_cast<HandleScopeImplementer*>(storage);
6071 scope_implementer->IterateThis(v); 6076 scope_implementer->IterateThis(v);
6072 return storage + ArchiveSpacePerThread(); 6077 return storage + ArchiveSpacePerThread();
6073 } 6078 }
6074 6079
6075 } } // namespace v8::internal 6080 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698