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

Side by Side Diff: src/handles.cc

Issue 11312185: Function::GetScriptOrigin should supply sourceURL when script name is not available. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 | « src/handles.h ('k') | src/isolate.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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 result = enum_fun(info); 586 result = enum_fun(info);
587 #if ENABLE_EXTRA_CHECKS 587 #if ENABLE_EXTRA_CHECKS
588 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject()); 588 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject());
589 #endif 589 #endif
590 } 590 }
591 } 591 }
592 return result; 592 return result;
593 } 593 }
594 594
595 595
596 Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) {
597 Isolate* isolate = script->GetIsolate();
598 Handle<String> name_or_source_url_key =
599 isolate->factory()->LookupAsciiSymbol("nameOrSourceURL");
600 Handle<JSValue> script_wrapper = GetScriptWrapper(script);
601 Handle<Object> property = GetProperty(script_wrapper,
602 name_or_source_url_key);
603 ASSERT(property->IsJSFunction());
604 Handle<JSFunction> method = Handle<JSFunction>::cast(property);
605 bool caught_exception;
606 Handle<Object> result = Execution::TryCall(method, script_wrapper, 0,
607 NULL, &caught_exception);
608 if (caught_exception) {
609 result = isolate->factory()->undefined_value();
610 }
611 return result;
612 }
613
614
596 static bool ContainsOnlyValidKeys(Handle<FixedArray> array) { 615 static bool ContainsOnlyValidKeys(Handle<FixedArray> array) {
597 int len = array->length(); 616 int len = array->length();
598 for (int i = 0; i < len; i++) { 617 for (int i = 0; i < len; i++) {
599 Object* e = array->get(i); 618 Object* e = array->get(i);
600 if (!(e->IsString() || e->IsNumber())) return false; 619 if (!(e->IsString() || e->IsNumber())) return false;
601 } 620 }
602 return true; 621 return true;
603 } 622 }
604 623
605 624
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 data->next = prev_next_; 1077 data->next = prev_next_;
1059 data->limit = prev_limit_; 1078 data->limit = prev_limit_;
1060 #ifdef DEBUG 1079 #ifdef DEBUG
1061 handles_detached_ = true; 1080 handles_detached_ = true;
1062 #endif 1081 #endif
1063 return deferred; 1082 return deferred;
1064 } 1083 }
1065 1084
1066 1085
1067 } } // namespace v8::internal 1086 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698