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

Side by Side Diff: src/api.cc

Issue 5862002: Version 3.0.2. (Closed)
Patch Set: Created 10 years 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 EnsureConstructor(this); 1158 EnsureConstructor(this);
1159 } 1159 }
1160 Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value)); 1160 Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value));
1161 } 1161 }
1162 1162
1163 1163
1164 // --- S c r i p t D a t a --- 1164 // --- S c r i p t D a t a ---
1165 1165
1166 1166
1167 ScriptData* ScriptData::PreCompile(const char* input, int length) { 1167 ScriptData* ScriptData::PreCompile(const char* input, int length) {
1168 i::Utf8ToUC16CharacterStream stream( 1168 unibrow::Utf8InputBuffer<> buf(input, length);
1169 reinterpret_cast<const unsigned char*>(input), length); 1169 return i::ParserApi::PreParse(i::Handle<i::String>(), &buf, NULL);
1170 return i::ParserApi::PreParse(&stream, NULL);
1171 } 1170 }
1172 1171
1173 1172
1174 ScriptData* ScriptData::PreCompile(v8::Handle<String> source) { 1173 ScriptData* ScriptData::PreCompile(v8::Handle<String> source) {
1175 i::Handle<i::String> str = Utils::OpenHandle(*source); 1174 i::Handle<i::String> str = Utils::OpenHandle(*source);
1176 if (str->IsExternalTwoByteString()) { 1175 return i::ParserApi::PreParse(str, NULL, NULL);
1177 i::ExternalTwoByteStringUC16CharacterStream stream(
1178 i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length());
1179 return i::ParserApi::PreParse(&stream, NULL);
1180 } else {
1181 i::GenericStringUC16CharacterStream stream(str, 0, str->length());
1182 return i::ParserApi::PreParse(&stream, NULL);
1183 }
1184 } 1176 }
1185 1177
1186 1178
1187 ScriptData* ScriptData::New(const char* data, int length) { 1179 ScriptData* ScriptData::New(const char* data, int length) {
1188 // Return an empty ScriptData if the length is obviously invalid. 1180 // Return an empty ScriptData if the length is obviously invalid.
1189 if (length % sizeof(unsigned) != 0) { 1181 if (length % sizeof(unsigned) != 0) {
1190 return new i::ScriptDataImpl(); 1182 return new i::ScriptDataImpl();
1191 } 1183 }
1192 1184
1193 // Copy the data to ensure it is properly aligned. 1185 // Copy the data to ensure it is properly aligned.
(...skipping 3746 matching lines...) Expand 10 before | Expand all | Expand 10 after
4940 4932
4941 4933
4942 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { 4934 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) {
4943 IsDeadCheck("v8::HeapProfiler::FindSnapshot"); 4935 IsDeadCheck("v8::HeapProfiler::FindSnapshot");
4944 return reinterpret_cast<const HeapSnapshot*>( 4936 return reinterpret_cast<const HeapSnapshot*>(
4945 i::HeapProfiler::FindSnapshot(uid)); 4937 i::HeapProfiler::FindSnapshot(uid));
4946 } 4938 }
4947 4939
4948 4940
4949 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title, 4941 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
4950 HeapSnapshot::Type type, 4942 HeapSnapshot::Type type) {
4951 ActivityControl* control) {
4952 IsDeadCheck("v8::HeapProfiler::TakeSnapshot"); 4943 IsDeadCheck("v8::HeapProfiler::TakeSnapshot");
4953 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull; 4944 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull;
4954 switch (type) { 4945 switch (type) {
4955 case HeapSnapshot::kFull: 4946 case HeapSnapshot::kFull:
4956 internal_type = i::HeapSnapshot::kFull; 4947 internal_type = i::HeapSnapshot::kFull;
4957 break; 4948 break;
4958 case HeapSnapshot::kAggregated: 4949 case HeapSnapshot::kAggregated:
4959 internal_type = i::HeapSnapshot::kAggregated; 4950 internal_type = i::HeapSnapshot::kAggregated;
4960 break; 4951 break;
4961 default: 4952 default:
4962 UNREACHABLE(); 4953 UNREACHABLE();
4963 } 4954 }
4964 return reinterpret_cast<const HeapSnapshot*>( 4955 return reinterpret_cast<const HeapSnapshot*>(
4965 i::HeapProfiler::TakeSnapshot( 4956 i::HeapProfiler::TakeSnapshot(*Utils::OpenHandle(*title), internal_type));
4966 *Utils::OpenHandle(*title), internal_type, control));
4967 } 4957 }
4968 4958
4969 #endif // ENABLE_LOGGING_AND_PROFILING 4959 #endif // ENABLE_LOGGING_AND_PROFILING
4970 4960
4971 4961
4972 v8::Testing::StressType internal::Testing::stress_type_ = 4962 v8::Testing::StressType internal::Testing::stress_type_ =
4973 v8::Testing::kStressTypeOpt; 4963 v8::Testing::kStressTypeOpt;
4974 4964
4975 4965
4976 void Testing::SetStressRunType(Testing::StressType type) { 4966 void Testing::SetStressRunType(Testing::StressType type) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
5105 5095
5106 5096
5107 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5097 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5108 HandleScopeImplementer* thread_local = 5098 HandleScopeImplementer* thread_local =
5109 reinterpret_cast<HandleScopeImplementer*>(storage); 5099 reinterpret_cast<HandleScopeImplementer*>(storage);
5110 thread_local->IterateThis(v); 5100 thread_local->IterateThis(v);
5111 return storage + ArchiveSpacePerThread(); 5101 return storage + ArchiveSpacePerThread();
5112 } 5102 }
5113 5103
5114 } } // namespace v8::internal 5104 } } // namespace v8::internal
OLDNEW
« ChangeLog ('K') | « samples/shell.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698