| 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/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 isolate, JSObject::SetOwnElement(object, index, function, STRICT)); | 169 isolate, JSObject::SetOwnElement(object, index, function, STRICT)); |
| 170 } else { | 170 } else { |
| 171 RETURN_FAILURE_ON_EXCEPTION( | 171 RETURN_FAILURE_ON_EXCEPTION( |
| 172 isolate, | 172 isolate, |
| 173 JSObject::SetOwnPropertyIgnoreAttributes(object, name, function, NONE)); | 173 JSObject::SetOwnPropertyIgnoreAttributes(object, name, function, NONE)); |
| 174 } | 174 } |
| 175 return isolate->heap()->undefined_value(); | 175 return isolate->heap()->undefined_value(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 | 178 |
| 179 RUNTIME_FUNCTION(Runtime_DefineClassGetter) { | |
| 180 HandleScope scope(isolate); | |
| 181 DCHECK(args.length() == 3); | |
| 182 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | |
| 183 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | |
| 184 CONVERT_ARG_HANDLE_CHECKED(JSFunction, getter, 2); | |
| 185 | |
| 186 Handle<Name> name; | |
| 187 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, | |
| 188 Runtime::ToName(isolate, key)); | |
| 189 RETURN_FAILURE_ON_EXCEPTION( | |
| 190 isolate, | |
| 191 JSObject::DefineAccessor(object, name, getter, | |
| 192 isolate->factory()->null_value(), NONE)); | |
| 193 return isolate->heap()->undefined_value(); | |
| 194 } | |
| 195 | |
| 196 | |
| 197 RUNTIME_FUNCTION(Runtime_DefineClassSetter) { | |
| 198 HandleScope scope(isolate); | |
| 199 DCHECK(args.length() == 3); | |
| 200 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | |
| 201 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | |
| 202 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); | |
| 203 | |
| 204 Handle<Name> name; | |
| 205 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, | |
| 206 Runtime::ToName(isolate, key)); | |
| 207 RETURN_FAILURE_ON_EXCEPTION( | |
| 208 isolate, | |
| 209 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), | |
| 210 setter, NONE)); | |
| 211 return isolate->heap()->undefined_value(); | |
| 212 } | |
| 213 | |
| 214 | |
| 215 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { | 179 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { |
| 216 HandleScope shs(isolate); | 180 HandleScope shs(isolate); |
| 217 DCHECK(args.length() == 1); | 181 DCHECK(args.length() == 1); |
| 218 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); | 182 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); |
| 219 | 183 |
| 220 Handle<Object> script; | 184 Handle<Object> script; |
| 221 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 185 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 222 isolate, script, | 186 isolate, script, |
| 223 Object::GetProperty(fun, isolate->factory()->class_script_symbol())); | 187 Object::GetProperty(fun, isolate->factory()->class_script_symbol())); |
| 224 if (!script->IsScript()) { | 188 if (!script->IsScript()) { |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 } | 442 } |
| 479 | 443 |
| 480 Handle<Object> result; | 444 Handle<Object> result; |
| 481 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 445 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 482 isolate, result, | 446 isolate, result, |
| 483 Execution::Call(isolate, proto_function, receiver, argc, argv, false)); | 447 Execution::Call(isolate, proto_function, receiver, argc, argv, false)); |
| 484 return *result; | 448 return *result; |
| 485 } | 449 } |
| 486 } | 450 } |
| 487 } // namespace v8::internal | 451 } // namespace v8::internal |
| OLD | NEW |