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

Side by Side Diff: src/runtime/runtime-classes.cc

Issue 1540953004: [runtime] Rewrite Function.prototype.toString in C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typos. Created 4 years, 12 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <limits> 8 #include <limits>
9 9
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 Object::THROW_ON_ERROR), 238 Object::THROW_ON_ERROR),
239 isolate->heap()->exception()); 239 isolate->heap()->exception());
240 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(constructor, FROZEN, 240 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(constructor, FROZEN,
241 Object::THROW_ON_ERROR), 241 Object::THROW_ON_ERROR),
242 isolate->heap()->exception()); 242 isolate->heap()->exception());
243 } 243 }
244 return *constructor; 244 return *constructor;
245 } 245 }
246 246
247 247
248 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) {
249 HandleScope shs(isolate);
250 DCHECK(args.length() == 1);
251 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
252
253 Handle<Symbol> start_position_symbol(
254 isolate->heap()->class_start_position_symbol());
255 Handle<Object> start_position =
256 JSReceiver::GetDataProperty(fun, start_position_symbol);
257 if (!start_position->IsSmi()) return isolate->heap()->undefined_value();
258
259 Handle<Symbol> end_position_symbol(
260 isolate->heap()->class_end_position_symbol());
261 Handle<Object> end_position =
262 JSReceiver::GetDataProperty(fun, end_position_symbol);
263 CHECK(end_position->IsSmi());
264
265 Handle<String> source(
266 String::cast(Script::cast(fun->shared()->script())->source()));
267 return *isolate->factory()->NewSubString(
268 source, Handle<Smi>::cast(start_position)->value(),
269 Handle<Smi>::cast(end_position)->value());
270 }
271
272
273 static MaybeHandle<Object> LoadFromSuper(Isolate* isolate, 248 static MaybeHandle<Object> LoadFromSuper(Isolate* isolate,
274 Handle<Object> receiver, 249 Handle<Object> receiver,
275 Handle<JSObject> home_object, 250 Handle<JSObject> home_object,
276 Handle<Name> name, 251 Handle<Name> name,
277 LanguageMode language_mode) { 252 LanguageMode language_mode) {
278 if (home_object->IsAccessCheckNeeded() && 253 if (home_object->IsAccessCheckNeeded() &&
279 !isolate->MayAccess(handle(isolate->context()), home_object)) { 254 !isolate->MayAccess(handle(isolate->context()), home_object)) {
280 isolate->ReportFailedAccessCheck(home_object); 255 isolate->ReportFailedAccessCheck(home_object);
281 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); 256 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
282 } 257 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 466
492 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) { 467 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) {
493 SealHandleScope shs(isolate); 468 SealHandleScope shs(isolate);
494 DCHECK_EQ(1, args.length()); 469 DCHECK_EQ(1, args.length());
495 CONVERT_ARG_CHECKED(JSFunction, active_function, 0); 470 CONVERT_ARG_CHECKED(JSFunction, active_function, 0);
496 return active_function->map()->prototype(); 471 return active_function->map()->prototype();
497 } 472 }
498 473
499 } // namespace internal 474 } // namespace internal
500 } // namespace v8 475 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698