OLD | NEW |
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/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 RUNTIME_FUNCTION(Runtime_DefineClassMethod) { | 196 RUNTIME_FUNCTION(Runtime_DefineClassMethod) { |
197 HandleScope scope(isolate); | 197 HandleScope scope(isolate); |
198 DCHECK(args.length() == 3); | 198 DCHECK(args.length() == 3); |
199 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 199 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
200 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 200 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
201 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 2); | 201 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 2); |
202 | 202 |
203 RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::DefinePropertyOrElement( | 203 uint32_t index; |
204 object, name, function, DONT_ENUM)); | 204 if (name->AsArrayIndex(&index)) { |
| 205 RETURN_FAILURE_ON_EXCEPTION( |
| 206 isolate, JSObject::SetOwnElementIgnoreAttributes(object, index, |
| 207 function, DONT_ENUM)); |
| 208 } else { |
| 209 RETURN_FAILURE_ON_EXCEPTION( |
| 210 isolate, JSObject::SetOwnPropertyIgnoreAttributes(object, name, |
| 211 function, DONT_ENUM)); |
| 212 } |
205 return isolate->heap()->undefined_value(); | 213 return isolate->heap()->undefined_value(); |
206 } | 214 } |
207 | 215 |
208 | 216 |
209 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { | 217 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { |
210 HandleScope shs(isolate); | 218 HandleScope shs(isolate); |
211 DCHECK(args.length() == 1); | 219 DCHECK(args.length() == 1); |
212 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); | 220 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); |
213 | 221 |
214 Handle<Object> script; | 222 Handle<Object> script; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 return nullptr; | 455 return nullptr; |
448 } | 456 } |
449 | 457 |
450 | 458 |
451 RUNTIME_FUNCTION(Runtime_CallSuperWithSpread) { | 459 RUNTIME_FUNCTION(Runtime_CallSuperWithSpread) { |
452 UNIMPLEMENTED(); | 460 UNIMPLEMENTED(); |
453 return nullptr; | 461 return nullptr; |
454 } | 462 } |
455 } // namespace internal | 463 } // namespace internal |
456 } // namespace v8 | 464 } // namespace v8 |
OLD | NEW |