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

Side by Side Diff: src/accessors.cc

Issue 196133017: Experimental parser: merge r19949 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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/allocation-tracker.h » ('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 // 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 345
346 const AccessorDescriptor Accessors::ScriptColumnOffset = { 346 const AccessorDescriptor Accessors::ScriptColumnOffset = {
347 ScriptGetColumnOffset, 347 ScriptGetColumnOffset,
348 IllegalSetter, 348 IllegalSetter,
349 0 349 0
350 }; 350 };
351 351
352 352
353 // 353 //
354 // Accessors::ScriptData
355 //
356
357
358 MaybeObject* Accessors::ScriptGetData(Isolate* isolate,
359 Object* object,
360 void*) {
361 Object* script = JSValue::cast(object)->value();
362 return Script::cast(script)->data();
363 }
364
365
366 const AccessorDescriptor Accessors::ScriptData = {
367 ScriptGetData,
368 IllegalSetter,
369 0
370 };
371
372
373 //
374 // Accessors::ScriptType 354 // Accessors::ScriptType
375 // 355 //
376 356
377 357
378 MaybeObject* Accessors::ScriptGetType(Isolate* isolate, 358 MaybeObject* Accessors::ScriptGetType(Isolate* isolate,
379 Object* object, 359 Object* object,
380 void*) { 360 void*) {
381 Object* script = JSValue::cast(object)->value(); 361 Object* script = JSValue::cast(object)->value();
382 return Script::cast(script)->type(); 362 return Script::cast(script)->type();
383 } 363 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 Handle<Object> value(value_raw, isolate); 593 Handle<Object> value(value_raw, isolate);
614 if (!function->should_have_prototype()) { 594 if (!function->should_have_prototype()) {
615 // Since we hit this accessor, object will have no prototype property. 595 // Since we hit this accessor, object will have no prototype property.
616 Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes(object, 596 Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes(object,
617 isolate->factory()->prototype_string(), value, NONE); 597 isolate->factory()->prototype_string(), value, NONE);
618 RETURN_IF_EMPTY_HANDLE(isolate, result); 598 RETURN_IF_EMPTY_HANDLE(isolate, result);
619 return *result; 599 return *result;
620 } 600 }
621 601
622 Handle<Object> old_value; 602 Handle<Object> old_value;
623 bool is_observed = 603 bool is_observed = *function == *object && function->map()->is_observed();
624 FLAG_harmony_observation &&
625 *function == *object &&
626 function->map()->is_observed();
627 if (is_observed) { 604 if (is_observed) {
628 if (function->has_prototype()) 605 if (function->has_prototype())
629 old_value = handle(function->prototype(), isolate); 606 old_value = handle(function->prototype(), isolate);
630 else 607 else
631 old_value = isolate->factory()->NewFunctionPrototype(function); 608 old_value = isolate->factory()->NewFunctionPrototype(function);
632 } 609 }
633 610
634 JSFunction::SetPrototype(function, value); 611 JSFunction::SetPrototype(function, value);
635 ASSERT(function->prototype() == *value); 612 ASSERT(function->prototype() == *value);
636 613
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 } 881 }
905 if (!caller->shared()->native() && potential_caller != NULL) { 882 if (!caller->shared()->native() && potential_caller != NULL) {
906 caller = potential_caller; 883 caller = potential_caller;
907 } 884 }
908 // If caller is bound, return null. This is compatible with JSC, and 885 // If caller is bound, return null. This is compatible with JSC, and
909 // allows us to make bound functions use the strict function map 886 // allows us to make bound functions use the strict function map
910 // and its associated throwing caller and arguments. 887 // and its associated throwing caller and arguments.
911 if (caller->shared()->bound()) { 888 if (caller->shared()->bound()) {
912 return isolate->heap()->null_value(); 889 return isolate->heap()->null_value();
913 } 890 }
914 // Censor if the caller is not a classic mode function. 891 // Censor if the caller is not a sloppy mode function.
915 // Change from ES5, which used to throw, see: 892 // Change from ES5, which used to throw, see:
916 // https://bugs.ecmascript.org/show_bug.cgi?id=310 893 // https://bugs.ecmascript.org/show_bug.cgi?id=310
917 if (!caller->shared()->is_classic_mode()) { 894 if (caller->shared()->strict_mode() == STRICT) {
918 return isolate->heap()->null_value(); 895 return isolate->heap()->null_value();
919 } 896 }
920 897
921 return caller; 898 return caller;
922 } 899 }
923 900
924 901
925 const AccessorDescriptor Accessors::FunctionCaller = { 902 const AccessorDescriptor Accessors::FunctionCaller = {
926 FunctionGetCaller, 903 FunctionGetCaller,
927 ReadOnlySetAccessor, 904 ReadOnlySetAccessor,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 info->set_data(Smi::FromInt(index)); 965 info->set_data(Smi::FromInt(index));
989 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 966 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
990 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 967 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
991 info->set_getter(*getter); 968 info->set_getter(*getter);
992 if (!(attributes & ReadOnly)) info->set_setter(*setter); 969 if (!(attributes & ReadOnly)) info->set_setter(*setter);
993 return info; 970 return info;
994 } 971 }
995 972
996 973
997 } } // namespace v8::internal 974 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.h ('k') | src/allocation-tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698