Changeset 94811 in webkit for trunk/Source/JavaScriptCore/jsc.cpp
- Timestamp:
- Sep 8, 2011, 3:38:44 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jsc.cpp
r94644 r94811 262 262 263 263 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 264 Completion result = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName)); 265 if (result.complType() == Throw) 266 throwError(exec, result.value()); 267 return JSValue::encode(result.value()); 264 265 JSValue evaluationException; 266 JSValue result = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName), JSValue(), &evaluationException); 267 if (evaluationException) 268 throwError(exec, evaluationException); 269 return JSValue::encode(result); 268 270 } 269 271 … … 279 281 StopWatch stopWatch; 280 282 stopWatch.start(); 281 Completion result = checkSyntax(globalObject->globalExec(), makeSource(script.data(), fileName)); 283 284 JSValue syntaxException; 285 bool validSyntax = checkSyntax(globalObject->globalExec(), makeSource(script.data(), fileName), &syntaxException); 282 286 stopWatch.stop(); 283 287 284 if ( result.complType() == Throw)285 throwError(exec, result.value());288 if (!validSyntax) 289 throwError(exec, syntaxException); 286 290 return JSValue::encode(jsNumber(stopWatch.getElapsedMS())); 287 291 } … … 437 441 globalData.startSampling(); 438 442 439 Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script, fileName)); 440 success = success && completion.complType() != Throw; 443 JSValue evaluationException; 444 JSValue returnValue = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script, fileName), JSValue(), &evaluationException); 445 success = success && !evaluationException; 441 446 if (dump) { 442 if ( completion.complType() == Throw)443 printf("Exception: %s\n", completion.value().toString(globalObject->globalExec()).utf8().data());447 if (evaluationException) 448 printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec()).utf8().data()); 444 449 else 445 printf("End: %s\n", completion.value().toString(globalObject->globalExec()).utf8().data());450 printf("End: %s\n", returnValue.toString(globalObject->globalExec()).utf8().data()); 446 451 } 447 452 … … 474 479 if (line[0]) 475 480 add_history(line); 476 Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(line, interpreterName)); 481 JSValue evaluationException; 482 JSValue returnValue = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(line, interpreterName), JSValue(), &evaluationException); 477 483 free(line); 478 484 #else … … 489 495 break; 490 496 line.append('\0'); 491 Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(line.data(), interpreterName)); 492 #endif 493 if (completion.complType() == Throw) 494 printf("Exception: %s\n", completion.value().toString(globalObject->globalExec()).utf8().data()); 497 498 JSValue evaluationException; 499 JSValue returnValue = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(line.data(), interpreterName), JSValue(), &evaluationException); 500 #endif 501 if (evaluationException) 502 printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec()).utf8().data()); 495 503 else 496 printf("%s\n", completion.value().toString(globalObject->globalExec()).utf8().data());504 printf("%s\n", returnValue.toString(globalObject->globalExec()).utf8().data()); 497 505 498 506 globalObject->globalExec()->clearException();
Note:
See TracChangeset
for help on using the changeset viewer.