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

Side by Side Diff: src/accessors.cc

Issue 258243003: Remove old-style accessor support from runtime. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comment Created 6 years, 7 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/ic.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 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 25 matching lines...) Expand all
36 #include "frames-inl.h" 36 #include "frames-inl.h"
37 #include "isolate.h" 37 #include "isolate.h"
38 #include "list-inl.h" 38 #include "list-inl.h"
39 #include "property-details.h" 39 #include "property-details.h"
40 #include "api.h" 40 #include "api.h"
41 41
42 namespace v8 { 42 namespace v8 {
43 namespace internal { 43 namespace internal {
44 44
45 45
46 static Handle<AccessorInfo> MakeAccessor(Isolate* isolate, 46 Handle<AccessorInfo> Accessors::MakeAccessor(
47 Handle<String> name, 47 Isolate* isolate,
48 AccessorGetterCallback getter, 48 Handle<String> name,
49 AccessorSetterCallback setter, 49 AccessorGetterCallback getter,
50 PropertyAttributes attributes) { 50 AccessorSetterCallback setter,
51 PropertyAttributes attributes) {
51 Factory* factory = isolate->factory(); 52 Factory* factory = isolate->factory();
52 Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo(); 53 Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo();
53 info->set_property_attributes(attributes); 54 info->set_property_attributes(attributes);
54 info->set_all_can_read(false); 55 info->set_all_can_read(false);
55 info->set_all_can_write(false); 56 info->set_all_can_write(false);
56 info->set_prohibits_overwriting(false); 57 info->set_prohibits_overwriting(false);
57 info->set_name(*name); 58 info->set_name(*name);
58 Handle<Object> get = v8::FromCData(isolate, getter); 59 Handle<Object> get = v8::FromCData(isolate, getter);
59 Handle<Object> set = v8::FromCData(isolate, setter); 60 Handle<Object> set = v8::FromCData(isolate, setter);
60 info->set_getter(*get); 61 info->set_getter(*get);
61 info->set_setter(*set); 62 info->set_setter(*set);
62 return info; 63 return info;
63 } 64 }
64 65
65 66
66 template <class C> 67 template <class C>
67 static C* FindInstanceOf(Isolate* isolate, Object* obj) { 68 static C* FindInstanceOf(Isolate* isolate, Object* obj) {
68 for (Object* cur = obj; !cur->IsNull(); cur = cur->GetPrototype(isolate)) { 69 for (Object* cur = obj; !cur->IsNull(); cur = cur->GetPrototype(isolate)) {
69 if (Is<C>(cur)) return C::cast(cur); 70 if (Is<C>(cur)) return C::cast(cur);
70 } 71 }
71 return NULL; 72 return NULL;
72 } 73 }
73 74
74 75
75 // Entry point that never should be called.
76 Object* Accessors::IllegalSetter(Isolate* isolate,
77 JSObject*,
78 Object*,
79 void*) {
80 UNREACHABLE();
81 return NULL;
82 }
83
84
85 Object* Accessors::IllegalGetAccessor(Isolate* isolate,
86 Object* object,
87 void*) {
88 UNREACHABLE();
89 return object;
90 }
91
92
93 Object* Accessors::ReadOnlySetAccessor(Isolate* isolate,
94 JSObject*,
95 Object* value,
96 void*) {
97 // According to ECMA-262, section 8.6.2.2, page 28, setting
98 // read-only properties must be silently ignored.
99 return value;
100 }
101
102
103 static V8_INLINE bool CheckForName(Handle<String> name, 76 static V8_INLINE bool CheckForName(Handle<String> name,
104 Handle<String> property_name, 77 Handle<String> property_name,
105 int offset, 78 int offset,
106 int* object_offset) { 79 int* object_offset) {
107 if (String::Equals(name, property_name)) { 80 if (String::Equals(name, property_name)) {
108 *object_offset = offset; 81 *object_offset = offset;
109 return true; 82 return true;
110 } 83 }
111 return false; 84 return false;
112 } 85 }
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 info->set_data(Smi::FromInt(index)); 1336 info->set_data(Smi::FromInt(index));
1364 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 1337 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1365 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 1338 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1366 info->set_getter(*getter); 1339 info->set_getter(*getter);
1367 if (!(attributes & ReadOnly)) info->set_setter(*setter); 1340 if (!(attributes & ReadOnly)) info->set_setter(*setter);
1368 return info; 1341 return info;
1369 } 1342 }
1370 1343
1371 1344
1372 } } // namespace v8::internal 1345 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.h ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698