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

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

Issue 807033003: Revert of ES6 computed property names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 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
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-object.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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 handle(Smi::FromInt(end_position), isolate), STRICT)); 146 handle(Smi::FromInt(end_position), isolate), STRICT));
147 147
148 return *constructor; 148 return *constructor;
149 } 149 }
150 150
151 151
152 RUNTIME_FUNCTION(Runtime_DefineClassMethod) { 152 RUNTIME_FUNCTION(Runtime_DefineClassMethod) {
153 HandleScope scope(isolate); 153 HandleScope scope(isolate);
154 DCHECK(args.length() == 3); 154 DCHECK(args.length() == 3);
155 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 155 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
156 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); 156 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
157 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 2); 157 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 2);
158 158
159 uint32_t index; 159 uint32_t index;
160 if (key->ToArrayIndex(&index)) {
161 RETURN_FAILURE_ON_EXCEPTION(
162 isolate, JSObject::SetOwnElement(object, index, function, STRICT));
163 }
164
165 Handle<Name> name;
166 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
167 Runtime::ToName(isolate, key));
160 if (name->AsArrayIndex(&index)) { 168 if (name->AsArrayIndex(&index)) {
161 RETURN_FAILURE_ON_EXCEPTION( 169 RETURN_FAILURE_ON_EXCEPTION(
162 isolate, JSObject::SetOwnElement(object, index, function, STRICT)); 170 isolate, JSObject::SetOwnElement(object, index, function, STRICT));
163 } else { 171 } else {
164 RETURN_FAILURE_ON_EXCEPTION( 172 RETURN_FAILURE_ON_EXCEPTION(
165 isolate, 173 isolate,
166 JSObject::SetOwnPropertyIgnoreAttributes(object, name, function, NONE)); 174 JSObject::SetOwnPropertyIgnoreAttributes(object, name, function, NONE));
167 } 175 }
168 return isolate->heap()->undefined_value(); 176 return isolate->heap()->undefined_value();
169 } 177 }
170 178
179
180 RUNTIME_FUNCTION(Runtime_DefineClassGetter) {
181 HandleScope scope(isolate);
182 DCHECK(args.length() == 3);
183 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
184 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
185 CONVERT_ARG_HANDLE_CHECKED(JSFunction, getter, 2);
186
187 Handle<Name> name;
188 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
189 Runtime::ToName(isolate, key));
190 RETURN_FAILURE_ON_EXCEPTION(
191 isolate,
192 JSObject::DefineAccessor(object, name, getter,
193 isolate->factory()->null_value(), NONE));
194 return isolate->heap()->undefined_value();
195 }
196
197
198 RUNTIME_FUNCTION(Runtime_DefineClassSetter) {
199 HandleScope scope(isolate);
200 DCHECK(args.length() == 3);
201 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
202 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
203 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2);
204
205 Handle<Name> name;
206 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
207 Runtime::ToName(isolate, key));
208 RETURN_FAILURE_ON_EXCEPTION(
209 isolate,
210 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(),
211 setter, NONE));
212 return isolate->heap()->undefined_value();
213 }
214
171 215
172 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { 216 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) {
173 HandleScope shs(isolate); 217 HandleScope shs(isolate);
174 DCHECK(args.length() == 1); 218 DCHECK(args.length() == 1);
175 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); 219 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
176 220
177 Handle<Object> script; 221 Handle<Object> script;
178 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 222 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
179 isolate, script, 223 isolate, script,
180 Object::GetProperty(fun, isolate->factory()->class_script_symbol())); 224 Object::GetProperty(fun, isolate->factory()->class_script_symbol()));
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 479 }
436 480
437 Handle<Object> result; 481 Handle<Object> result;
438 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 482 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
439 isolate, result, 483 isolate, result,
440 Execution::Call(isolate, proto_function, receiver, argc, argv, false)); 484 Execution::Call(isolate, proto_function, receiver, argc, argv, false));
441 return *result; 485 return *result;
442 } 486 }
443 } 487 }
444 } // namespace v8::internal 488 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698