| OLD | NEW | 
|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 282 | 282 | 
| 283 | 283 | 
| 284 const AccessorDescriptor Accessors::ScriptType = { | 284 const AccessorDescriptor Accessors::ScriptType = { | 
| 285   ScriptGetType, | 285   ScriptGetType, | 
| 286   IllegalSetter, | 286   IllegalSetter, | 
| 287   0 | 287   0 | 
| 288 }; | 288 }; | 
| 289 | 289 | 
| 290 | 290 | 
| 291 // | 291 // | 
|  | 292 // Accessors::ScriptCompilationType | 
|  | 293 // | 
|  | 294 | 
|  | 295 | 
|  | 296 Object* Accessors::ScriptGetCompilationType(Object* object, void*) { | 
|  | 297   Object* script = JSValue::cast(object)->value(); | 
|  | 298   return Script::cast(script)->compilation_type(); | 
|  | 299 } | 
|  | 300 | 
|  | 301 | 
|  | 302 const AccessorDescriptor Accessors::ScriptCompilationType = { | 
|  | 303   ScriptGetCompilationType, | 
|  | 304   IllegalSetter, | 
|  | 305   0 | 
|  | 306 }; | 
|  | 307 | 
|  | 308 | 
|  | 309 // | 
| 292 // Accessors::ScriptGetLineEnds | 310 // Accessors::ScriptGetLineEnds | 
| 293 // | 311 // | 
| 294 | 312 | 
| 295 | 313 | 
| 296 Object* Accessors::ScriptGetLineEnds(Object* object, void*) { | 314 Object* Accessors::ScriptGetLineEnds(Object* object, void*) { | 
| 297   HandleScope scope; | 315   HandleScope scope; | 
| 298   Handle<Script> script(Script::cast(JSValue::cast(object)->value())); | 316   Handle<Script> script(Script::cast(JSValue::cast(object)->value())); | 
| 299   InitScriptLineEnds(script); | 317   InitScriptLineEnds(script); | 
| 300   return script->line_ends(); | 318   return script->line_ends(); | 
| 301 } | 319 } | 
| 302 | 320 | 
| 303 | 321 | 
| 304 const AccessorDescriptor Accessors::ScriptLineEnds = { | 322 const AccessorDescriptor Accessors::ScriptLineEnds = { | 
| 305   ScriptGetLineEnds, | 323   ScriptGetLineEnds, | 
| 306   IllegalSetter, | 324   IllegalSetter, | 
| 307   0 | 325   0 | 
| 308 }; | 326 }; | 
| 309 | 327 | 
| 310 | 328 | 
| 311 // | 329 // | 
| 312 // Accessors::ScriptGetContextData | 330 // Accessors::ScriptGetContextData | 
| 313 // | 331 // | 
| 314 | 332 | 
| 315 | 333 | 
| 316 Object* Accessors::ScriptGetContextData(Object* object, void*) { | 334 Object* Accessors::ScriptGetContextData(Object* object, void*) { | 
| 317   HandleScope scope; | 335   Object* script = JSValue::cast(object)->value(); | 
| 318   Handle<Script> script(Script::cast(JSValue::cast(object)->value())); | 336   return Script::cast(script)->context_data(); | 
| 319   return script->context_data(); |  | 
| 320 } | 337 } | 
| 321 | 338 | 
| 322 | 339 | 
| 323 const AccessorDescriptor Accessors::ScriptContextData = { | 340 const AccessorDescriptor Accessors::ScriptContextData = { | 
| 324   ScriptGetContextData, | 341   ScriptGetContextData, | 
| 325   IllegalSetter, | 342   IllegalSetter, | 
| 326   0 | 343   0 | 
| 327 }; | 344 }; | 
| 328 | 345 | 
| 329 | 346 | 
| 330 // | 347 // | 
|  | 348 // Accessors::ScriptGetEvalFromFunction | 
|  | 349 // | 
|  | 350 | 
|  | 351 | 
|  | 352 Object* Accessors::ScriptGetEvalFromFunction(Object* object, void*) { | 
|  | 353   Object* script = JSValue::cast(object)->value(); | 
|  | 354   return Script::cast(script)->eval_from_function(); | 
|  | 355 } | 
|  | 356 | 
|  | 357 | 
|  | 358 const AccessorDescriptor Accessors::ScriptEvalFromFunction = { | 
|  | 359   ScriptGetEvalFromFunction, | 
|  | 360   IllegalSetter, | 
|  | 361   0 | 
|  | 362 }; | 
|  | 363 | 
|  | 364 | 
|  | 365 // | 
|  | 366 // Accessors::ScriptGetEvalFromPosition | 
|  | 367 // | 
|  | 368 | 
|  | 369 | 
|  | 370 Object* Accessors::ScriptGetEvalFromPosition(Object* object, void*) { | 
|  | 371   HandleScope scope; | 
|  | 372   Handle<Script> script(Script::cast(JSValue::cast(object)->value())); | 
|  | 373 | 
|  | 374   // If this is not a script compiled through eval there is no eval position. | 
|  | 375   int compilation_type = Smi::cast(script->compilation_type())->value(); | 
|  | 376   if (compilation_type != Script::COMPILATION_TYPE_EVAL) { | 
|  | 377     return Heap::undefined_value(); | 
|  | 378   } | 
|  | 379 | 
|  | 380   // Get the function from where eval was called and find the source position | 
|  | 381   // from the instruction offset. | 
|  | 382   Handle<Code> code(JSFunction::cast(script->eval_from_function())->code()); | 
|  | 383   return Smi::FromInt(code->SourcePosition(code->instruction_start() + | 
|  | 384                       script->eval_from_instructions_offset()->value())); | 
|  | 385 } | 
|  | 386 | 
|  | 387 | 
|  | 388 const AccessorDescriptor Accessors::ScriptEvalFromPosition = { | 
|  | 389   ScriptGetEvalFromPosition, | 
|  | 390   IllegalSetter, | 
|  | 391   0 | 
|  | 392 }; | 
|  | 393 | 
|  | 394 | 
|  | 395 // | 
| 331 // Accessors::FunctionPrototype | 396 // Accessors::FunctionPrototype | 
| 332 // | 397 // | 
| 333 | 398 | 
| 334 | 399 | 
| 335 Object* Accessors::FunctionGetPrototype(Object* object, void*) { | 400 Object* Accessors::FunctionGetPrototype(Object* object, void*) { | 
| 336   bool found_it = false; | 401   bool found_it = false; | 
| 337   JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); | 402   JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); | 
| 338   if (!found_it) return Heap::undefined_value(); | 403   if (!found_it) return Heap::undefined_value(); | 
| 339   if (!function->has_prototype()) { | 404   if (!function->has_prototype()) { | 
| 340     Object* prototype = Heap::AllocateFunctionPrototype(function); | 405     Object* prototype = Heap::AllocateFunctionPrototype(function); | 
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 577 } | 642 } | 
| 578 | 643 | 
| 579 | 644 | 
| 580 const AccessorDescriptor Accessors::ObjectPrototype = { | 645 const AccessorDescriptor Accessors::ObjectPrototype = { | 
| 581   ObjectGetPrototype, | 646   ObjectGetPrototype, | 
| 582   ObjectSetPrototype, | 647   ObjectSetPrototype, | 
| 583   0 | 648   0 | 
| 584 }; | 649 }; | 
| 585 | 650 | 
| 586 } }  // namespace v8::internal | 651 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|