OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/accessors.h" | 5 #include "src/accessors.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/execution.h" | 10 #include "src/execution.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // | 311 // |
312 | 312 |
313 | 313 |
314 void Accessors::ScriptColumnOffsetGetter( | 314 void Accessors::ScriptColumnOffsetGetter( |
315 v8::Local<v8::Name> name, | 315 v8::Local<v8::Name> name, |
316 const v8::PropertyCallbackInfo<v8::Value>& info) { | 316 const v8::PropertyCallbackInfo<v8::Value>& info) { |
317 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 317 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
318 DisallowHeapAllocation no_allocation; | 318 DisallowHeapAllocation no_allocation; |
319 HandleScope scope(isolate); | 319 HandleScope scope(isolate); |
320 Object* object = *Utils::OpenHandle(*info.This()); | 320 Object* object = *Utils::OpenHandle(*info.This()); |
321 Object* res = Script::cast(JSValue::cast(object)->value())->column_offset(); | 321 Object* res = Smi::FromInt( |
| 322 Script::cast(JSValue::cast(object)->value())->column_offset()); |
322 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); | 323 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); |
323 } | 324 } |
324 | 325 |
325 | 326 |
326 void Accessors::ScriptColumnOffsetSetter( | 327 void Accessors::ScriptColumnOffsetSetter( |
327 v8::Local<v8::Name> name, | 328 v8::Local<v8::Name> name, |
328 v8::Local<v8::Value> value, | 329 v8::Local<v8::Value> value, |
329 const v8::PropertyCallbackInfo<void>& info) { | 330 const v8::PropertyCallbackInfo<void>& info) { |
330 UNREACHABLE(); | 331 UNREACHABLE(); |
331 } | 332 } |
(...skipping 16 matching lines...) Expand all Loading... |
348 // | 349 // |
349 | 350 |
350 | 351 |
351 void Accessors::ScriptIdGetter( | 352 void Accessors::ScriptIdGetter( |
352 v8::Local<v8::Name> name, | 353 v8::Local<v8::Name> name, |
353 const v8::PropertyCallbackInfo<v8::Value>& info) { | 354 const v8::PropertyCallbackInfo<v8::Value>& info) { |
354 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 355 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
355 DisallowHeapAllocation no_allocation; | 356 DisallowHeapAllocation no_allocation; |
356 HandleScope scope(isolate); | 357 HandleScope scope(isolate); |
357 Object* object = *Utils::OpenHandle(*info.This()); | 358 Object* object = *Utils::OpenHandle(*info.This()); |
358 Object* id = Script::cast(JSValue::cast(object)->value())->id(); | 359 Object* id = Smi::FromInt(Script::cast(JSValue::cast(object)->value())->id()); |
359 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(id, isolate))); | 360 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(id, isolate))); |
360 } | 361 } |
361 | 362 |
362 | 363 |
363 void Accessors::ScriptIdSetter( | 364 void Accessors::ScriptIdSetter( |
364 v8::Local<v8::Name> name, | 365 v8::Local<v8::Name> name, |
365 v8::Local<v8::Value> value, | 366 v8::Local<v8::Value> value, |
366 const v8::PropertyCallbackInfo<void>& info) { | 367 const v8::PropertyCallbackInfo<void>& info) { |
367 UNREACHABLE(); | 368 UNREACHABLE(); |
368 } | 369 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // | 456 // |
456 | 457 |
457 | 458 |
458 void Accessors::ScriptLineOffsetGetter( | 459 void Accessors::ScriptLineOffsetGetter( |
459 v8::Local<v8::Name> name, | 460 v8::Local<v8::Name> name, |
460 const v8::PropertyCallbackInfo<v8::Value>& info) { | 461 const v8::PropertyCallbackInfo<v8::Value>& info) { |
461 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 462 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
462 DisallowHeapAllocation no_allocation; | 463 DisallowHeapAllocation no_allocation; |
463 HandleScope scope(isolate); | 464 HandleScope scope(isolate); |
464 Object* object = *Utils::OpenHandle(*info.This()); | 465 Object* object = *Utils::OpenHandle(*info.This()); |
465 Object* res = Script::cast(JSValue::cast(object)->value())->line_offset(); | 466 Object* res = |
| 467 Smi::FromInt(Script::cast(JSValue::cast(object)->value())->line_offset()); |
466 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); | 468 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); |
467 } | 469 } |
468 | 470 |
469 | 471 |
470 void Accessors::ScriptLineOffsetSetter( | 472 void Accessors::ScriptLineOffsetSetter( |
471 v8::Local<v8::Name> name, | 473 v8::Local<v8::Name> name, |
472 v8::Local<v8::Value> value, | 474 v8::Local<v8::Value> value, |
473 const v8::PropertyCallbackInfo<void>& info) { | 475 const v8::PropertyCallbackInfo<void>& info) { |
474 UNREACHABLE(); | 476 UNREACHABLE(); |
475 } | 477 } |
(...skipping 16 matching lines...) Expand all Loading... |
492 // | 494 // |
493 | 495 |
494 | 496 |
495 void Accessors::ScriptTypeGetter( | 497 void Accessors::ScriptTypeGetter( |
496 v8::Local<v8::Name> name, | 498 v8::Local<v8::Name> name, |
497 const v8::PropertyCallbackInfo<v8::Value>& info) { | 499 const v8::PropertyCallbackInfo<v8::Value>& info) { |
498 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 500 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
499 DisallowHeapAllocation no_allocation; | 501 DisallowHeapAllocation no_allocation; |
500 HandleScope scope(isolate); | 502 HandleScope scope(isolate); |
501 Object* object = *Utils::OpenHandle(*info.This()); | 503 Object* object = *Utils::OpenHandle(*info.This()); |
502 Object* res = Script::cast(JSValue::cast(object)->value())->type(); | 504 Object* res = |
| 505 Smi::FromInt(Script::cast(JSValue::cast(object)->value())->type()); |
503 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); | 506 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); |
504 } | 507 } |
505 | 508 |
506 | 509 |
507 void Accessors::ScriptTypeSetter( | 510 void Accessors::ScriptTypeSetter( |
508 v8::Local<v8::Name> name, | 511 v8::Local<v8::Name> name, |
509 v8::Local<v8::Value> value, | 512 v8::Local<v8::Value> value, |
510 const v8::PropertyCallbackInfo<void>& info) { | 513 const v8::PropertyCallbackInfo<void>& info) { |
511 UNREACHABLE(); | 514 UNREACHABLE(); |
512 } | 515 } |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 const v8::PropertyCallbackInfo<v8::Value>& info) { | 810 const v8::PropertyCallbackInfo<v8::Value>& info) { |
808 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 811 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
809 HandleScope scope(isolate); | 812 HandleScope scope(isolate); |
810 Handle<Object> object = Utils::OpenHandle(*info.This()); | 813 Handle<Object> object = Utils::OpenHandle(*info.This()); |
811 Handle<Script> script( | 814 Handle<Script> script( |
812 Script::cast(Handle<JSValue>::cast(object)->value()), isolate); | 815 Script::cast(Handle<JSValue>::cast(object)->value()), isolate); |
813 Handle<Object> result = isolate->factory()->undefined_value(); | 816 Handle<Object> result = isolate->factory()->undefined_value(); |
814 if (script->compilation_type() == Script::COMPILATION_TYPE_EVAL) { | 817 if (script->compilation_type() == Script::COMPILATION_TYPE_EVAL) { |
815 Handle<Code> code(SharedFunctionInfo::cast( | 818 Handle<Code> code(SharedFunctionInfo::cast( |
816 script->eval_from_shared())->code()); | 819 script->eval_from_shared())->code()); |
817 result = Handle<Object>( | 820 result = Handle<Object>(Smi::FromInt(code->SourcePosition( |
818 Smi::FromInt(code->SourcePosition(code->instruction_start() + | 821 code->instruction_start() + |
819 script->eval_from_instructions_offset()->value())), | 822 script->eval_from_instructions_offset())), |
820 isolate); | 823 isolate); |
821 } | 824 } |
822 info.GetReturnValue().Set(Utils::ToLocal(result)); | 825 info.GetReturnValue().Set(Utils::ToLocal(result)); |
823 } | 826 } |
824 | 827 |
825 | 828 |
826 void Accessors::ScriptEvalFromScriptPositionSetter( | 829 void Accessors::ScriptEvalFromScriptPositionSetter( |
827 v8::Local<v8::Name> name, | 830 v8::Local<v8::Name> name, |
828 v8::Local<v8::Value> value, | 831 v8::Local<v8::Value> value, |
829 const v8::PropertyCallbackInfo<void>& info) { | 832 const v8::PropertyCallbackInfo<void>& info) { |
830 UNREACHABLE(); | 833 UNREACHABLE(); |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1505 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1503 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1506 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1504 info->set_getter(*getter); | 1507 info->set_getter(*getter); |
1505 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1508 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1506 return info; | 1509 return info; |
1507 } | 1510 } |
1508 | 1511 |
1509 | 1512 |
1510 } // namespace internal | 1513 } // namespace internal |
1511 } // namespace v8 | 1514 } // namespace v8 |
OLD | NEW |