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

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

Issue 894683003: Introduce LanguageMode, drop StrictMode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased (w/ conflicts) Created 5 years, 10 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
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-compiler.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 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 <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 Runtime::ToName(isolate, key)); 281 Runtime::ToName(isolate, key));
282 if (name->AsArrayIndex(&index)) { 282 if (name->AsArrayIndex(&index)) {
283 return LoadElementFromSuper(isolate, receiver, home_object, index); 283 return LoadElementFromSuper(isolate, receiver, home_object, index);
284 } 284 }
285 return LoadFromSuper(isolate, receiver, home_object, name); 285 return LoadFromSuper(isolate, receiver, home_object, name);
286 } 286 }
287 287
288 288
289 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object, 289 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object,
290 Handle<Object> receiver, Handle<Name> name, 290 Handle<Object> receiver, Handle<Name> name,
291 Handle<Object> value, StrictMode strict_mode) { 291 Handle<Object> value, LanguageMode language_mode) {
292 if (home_object->IsAccessCheckNeeded() && 292 if (home_object->IsAccessCheckNeeded() &&
293 !isolate->MayNamedAccess(home_object, name, v8::ACCESS_SET)) { 293 !isolate->MayNamedAccess(home_object, name, v8::ACCESS_SET)) {
294 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_SET); 294 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_SET);
295 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 295 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
296 } 296 }
297 297
298 PrototypeIterator iter(isolate, home_object); 298 PrototypeIterator iter(isolate, home_object);
299 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 299 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
300 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); 300 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
301 301
302 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); 302 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto));
303 Handle<Object> result; 303 Handle<Object> result;
304 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 304 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
305 isolate, result, 305 isolate, result,
306 Object::SetProperty(&it, value, strict_mode, 306 Object::SetProperty(&it, value, language_mode,
307 Object::CERTAINLY_NOT_STORE_FROM_KEYED, 307 Object::CERTAINLY_NOT_STORE_FROM_KEYED,
308 Object::SUPER_PROPERTY)); 308 Object::SUPER_PROPERTY));
309 return *result; 309 return *result;
310 } 310 }
311 311
312 312
313 static Object* StoreElementToSuper(Isolate* isolate, 313 static Object* StoreElementToSuper(Isolate* isolate,
314 Handle<JSObject> home_object, 314 Handle<JSObject> home_object,
315 Handle<Object> receiver, uint32_t index, 315 Handle<Object> receiver, uint32_t index,
316 Handle<Object> value, 316 Handle<Object> value,
317 StrictMode strict_mode) { 317 LanguageMode language_mode) {
318 if (home_object->IsAccessCheckNeeded() && 318 if (home_object->IsAccessCheckNeeded() &&
319 !isolate->MayIndexedAccess(home_object, index, v8::ACCESS_SET)) { 319 !isolate->MayIndexedAccess(home_object, index, v8::ACCESS_SET)) {
320 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_SET); 320 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_SET);
321 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 321 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
322 } 322 }
323 323
324 PrototypeIterator iter(isolate, home_object); 324 PrototypeIterator iter(isolate, home_object);
325 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 325 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
326 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); 326 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
327 327
328 Handle<Object> result; 328 Handle<Object> result;
329 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 329 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
330 isolate, result, 330 isolate, result,
331 Object::SetElementWithReceiver(isolate, proto, receiver, index, value, 331 Object::SetElementWithReceiver(isolate, proto, receiver, index, value,
332 strict_mode)); 332 language_mode));
333 return *result; 333 return *result;
334 } 334 }
335 335
336 336
337 RUNTIME_FUNCTION(Runtime_StoreToSuper_Strict) { 337 RUNTIME_FUNCTION(Runtime_StoreToSuper_Strict) {
338 HandleScope scope(isolate); 338 HandleScope scope(isolate);
339 DCHECK(args.length() == 4); 339 DCHECK(args.length() == 4);
340 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); 340 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
341 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); 341 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
342 CONVERT_ARG_HANDLE_CHECKED(Name, name, 2); 342 CONVERT_ARG_HANDLE_CHECKED(Name, name, 2);
(...skipping 10 matching lines...) Expand all
353 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); 353 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
354 CONVERT_ARG_HANDLE_CHECKED(Name, name, 2); 354 CONVERT_ARG_HANDLE_CHECKED(Name, name, 2);
355 CONVERT_ARG_HANDLE_CHECKED(Object, value, 3); 355 CONVERT_ARG_HANDLE_CHECKED(Object, value, 3);
356 356
357 return StoreToSuper(isolate, home_object, receiver, name, value, SLOPPY); 357 return StoreToSuper(isolate, home_object, receiver, name, value, SLOPPY);
358 } 358 }
359 359
360 360
361 static Object* StoreKeyedToSuper(Isolate* isolate, Handle<JSObject> home_object, 361 static Object* StoreKeyedToSuper(Isolate* isolate, Handle<JSObject> home_object,
362 Handle<Object> receiver, Handle<Object> key, 362 Handle<Object> receiver, Handle<Object> key,
363 Handle<Object> value, StrictMode strict_mode) { 363 Handle<Object> value,
364 LanguageMode language_mode) {
364 uint32_t index; 365 uint32_t index;
365 366
366 if (key->ToArrayIndex(&index)) { 367 if (key->ToArrayIndex(&index)) {
367 return StoreElementToSuper(isolate, home_object, receiver, index, value, 368 return StoreElementToSuper(isolate, home_object, receiver, index, value,
368 strict_mode); 369 language_mode);
369 } 370 }
370 Handle<Name> name; 371 Handle<Name> name;
371 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, 372 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
372 Runtime::ToName(isolate, key)); 373 Runtime::ToName(isolate, key));
373 if (name->AsArrayIndex(&index)) { 374 if (name->AsArrayIndex(&index)) {
374 return StoreElementToSuper(isolate, home_object, receiver, index, value, 375 return StoreElementToSuper(isolate, home_object, receiver, index, value,
375 strict_mode); 376 language_mode);
376 } 377 }
377 return StoreToSuper(isolate, home_object, receiver, name, value, strict_mode); 378 return StoreToSuper(isolate, home_object, receiver, name, value,
379 language_mode);
378 } 380 }
379 381
380 382
381 RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Strict) { 383 RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Strict) {
382 HandleScope scope(isolate); 384 HandleScope scope(isolate);
383 DCHECK(args.length() == 4); 385 DCHECK(args.length() == 4);
384 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); 386 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
385 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); 387 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
386 CONVERT_ARG_HANDLE_CHECKED(Object, key, 2); 388 CONVERT_ARG_HANDLE_CHECKED(Object, key, 2);
387 CONVERT_ARG_HANDLE_CHECKED(Object, value, 3); 389 CONVERT_ARG_HANDLE_CHECKED(Object, value, 3);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 } 444 }
443 445
444 Handle<Object> result; 446 Handle<Object> result;
445 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 447 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
446 isolate, result, 448 isolate, result,
447 Execution::Call(isolate, proto_function, receiver, argc, argv, false)); 449 Execution::Call(isolate, proto_function, receiver, argc, argv, false));
448 return *result; 450 return *result;
449 } 451 }
450 } 452 }
451 } // namespace v8::internal 453 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698