OLD | NEW |
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 }; | 285 }; |
286 | 286 |
287 | 287 |
288 // | 288 // |
289 // Accessors::ScriptCompilationType | 289 // Accessors::ScriptCompilationType |
290 // | 290 // |
291 | 291 |
292 | 292 |
293 MaybeObject* Accessors::ScriptGetCompilationType(Object* object, void*) { | 293 MaybeObject* Accessors::ScriptGetCompilationType(Object* object, void*) { |
294 Object* script = JSValue::cast(object)->value(); | 294 Object* script = JSValue::cast(object)->value(); |
295 return Script::cast(script)->compilation_type(); | 295 return Smi::FromInt(Script::cast(script)->compilation_type()); |
296 } | 296 } |
297 | 297 |
298 | 298 |
299 const AccessorDescriptor Accessors::ScriptCompilationType = { | 299 const AccessorDescriptor Accessors::ScriptCompilationType = { |
300 ScriptGetCompilationType, | 300 ScriptGetCompilationType, |
301 IllegalSetter, | 301 IllegalSetter, |
302 0 | 302 0 |
303 }; | 303 }; |
304 | 304 |
305 | 305 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 // Accessors::ScriptGetEvalFromScriptPosition | 381 // Accessors::ScriptGetEvalFromScriptPosition |
382 // | 382 // |
383 | 383 |
384 | 384 |
385 MaybeObject* Accessors::ScriptGetEvalFromScriptPosition(Object* object, void*) { | 385 MaybeObject* Accessors::ScriptGetEvalFromScriptPosition(Object* object, void*) { |
386 Script* raw_script = Script::cast(JSValue::cast(object)->value()); | 386 Script* raw_script = Script::cast(JSValue::cast(object)->value()); |
387 HandleScope scope(raw_script->GetIsolate()); | 387 HandleScope scope(raw_script->GetIsolate()); |
388 Handle<Script> script(raw_script); | 388 Handle<Script> script(raw_script); |
389 | 389 |
390 // If this is not a script compiled through eval there is no eval position. | 390 // If this is not a script compiled through eval there is no eval position. |
391 int compilation_type = Smi::cast(script->compilation_type())->value(); | 391 if (script->compilation_type() != Script::COMPILATION_TYPE_EVAL) { |
392 if (compilation_type != Script::COMPILATION_TYPE_EVAL) { | |
393 return script->GetHeap()->undefined_value(); | 392 return script->GetHeap()->undefined_value(); |
394 } | 393 } |
395 | 394 |
396 // Get the function from where eval was called and find the source position | 395 // Get the function from where eval was called and find the source position |
397 // from the instruction offset. | 396 // from the instruction offset. |
398 Handle<Code> code(SharedFunctionInfo::cast( | 397 Handle<Code> code(SharedFunctionInfo::cast( |
399 script->eval_from_shared())->code()); | 398 script->eval_from_shared())->code()); |
400 return Smi::FromInt(code->SourcePosition(code->instruction_start() + | 399 return Smi::FromInt(code->SourcePosition(code->instruction_start() + |
401 script->eval_from_instructions_offset()->value())); | 400 script->eval_from_instructions_offset()->value())); |
402 } | 401 } |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 info->set_data(Smi::FromInt(index)); | 848 info->set_data(Smi::FromInt(index)); |
850 Handle<Object> getter = v8::FromCData(&ModuleGetExport); | 849 Handle<Object> getter = v8::FromCData(&ModuleGetExport); |
851 Handle<Object> setter = v8::FromCData(&ModuleSetExport); | 850 Handle<Object> setter = v8::FromCData(&ModuleSetExport); |
852 info->set_getter(*getter); | 851 info->set_getter(*getter); |
853 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 852 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
854 return info; | 853 return info; |
855 } | 854 } |
856 | 855 |
857 | 856 |
858 } } // namespace v8::internal | 857 } } // namespace v8::internal |
OLD | NEW |