Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: src/accessors.cc

Issue 12254007: Make the Isolate parameter mandatory for internal HandleScopes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 0 376 0
377 }; 377 };
378 378
379 379
380 // 380 //
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 HandleScope scope; 386 Script* raw_script = Script::cast(JSValue::cast(object)->value());
387 Handle<Script> script(Script::cast(JSValue::cast(object)->value())); 387 HandleScope scope(raw_script->GetIsolate());
388 Handle<Script> script(raw_script);
388 389
389 // 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.
390 int compilation_type = Smi::cast(script->compilation_type())->value(); 391 int compilation_type = Smi::cast(script->compilation_type())->value();
391 if (compilation_type != Script::COMPILATION_TYPE_EVAL) { 392 if (compilation_type != Script::COMPILATION_TYPE_EVAL) {
392 return HEAP->undefined_value(); 393 return script->GetHeap()->undefined_value();
393 } 394 }
394 395
395 // Get the function from where eval was called and find the source position 396 // Get the function from where eval was called and find the source position
396 // from the instruction offset. 397 // from the instruction offset.
397 Handle<Code> code(SharedFunctionInfo::cast( 398 Handle<Code> code(SharedFunctionInfo::cast(
398 script->eval_from_shared())->code()); 399 script->eval_from_shared())->code());
399 return Smi::FromInt(code->SourcePosition(code->instruction_start() + 400 return Smi::FromInt(code->SourcePosition(code->instruction_start() +
400 script->eval_from_instructions_offset()->value())); 401 script->eval_from_instructions_offset()->value()));
401 } 402 }
402 403
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 523
523 MaybeObject* Accessors::FunctionGetLength(Object* object, void*) { 524 MaybeObject* Accessors::FunctionGetLength(Object* object, void*) {
524 JSFunction* function = FindInstanceOf<JSFunction>(object); 525 JSFunction* function = FindInstanceOf<JSFunction>(object);
525 if (function == NULL) return Smi::FromInt(0); 526 if (function == NULL) return Smi::FromInt(0);
526 // Check if already compiled. 527 // Check if already compiled.
527 if (function->shared()->is_compiled()) { 528 if (function->shared()->is_compiled()) {
528 return Smi::FromInt(function->shared()->length()); 529 return Smi::FromInt(function->shared()->length());
529 } 530 }
530 // If the function isn't compiled yet, the length is not computed correctly 531 // If the function isn't compiled yet, the length is not computed correctly
531 // yet. Compile it now and return the right length. 532 // yet. Compile it now and return the right length.
532 HandleScope scope; 533 HandleScope scope(function->GetIsolate());
533 Handle<JSFunction> handle(function); 534 Handle<JSFunction> handle(function);
534 if (JSFunction::CompileLazy(handle, KEEP_EXCEPTION)) { 535 if (JSFunction::CompileLazy(handle, KEEP_EXCEPTION)) {
535 return Smi::FromInt(handle->shared()->length()); 536 return Smi::FromInt(handle->shared()->length());
536 } 537 }
537 return Failure::Exception(); 538 return Failure::Exception();
538 } 539 }
539 540
540 541
541 const AccessorDescriptor Accessors::FunctionLength = { 542 const AccessorDescriptor Accessors::FunctionLength = {
542 FunctionGetLength, 543 FunctionGetLength,
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 info->set_data(Smi::FromInt(index)); 889 info->set_data(Smi::FromInt(index));
889 Handle<Object> getter = v8::FromCData(&ModuleGetExport); 890 Handle<Object> getter = v8::FromCData(&ModuleGetExport);
890 Handle<Object> setter = v8::FromCData(&ModuleSetExport); 891 Handle<Object> setter = v8::FromCData(&ModuleSetExport);
891 info->set_getter(*getter); 892 info->set_getter(*getter);
892 if (!(attributes & ReadOnly)) info->set_setter(*setter); 893 if (!(attributes & ReadOnly)) info->set_setter(*setter);
893 return info; 894 return info;
894 } 895 }
895 896
896 897
897 } } // namespace v8::internal 898 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698